Applebee's parent company is in the middle of a legal battle with one of its largest franchise groups. Hollis Johnson/Business Insider

Applebee's parent company, Dine Brands, and its second-largest franchisee, RMH Holdings, are battling in court, with Dine Brands attempting to take control of dozens of the franchisee's restaurants.

RMH controls more than 140 Applebee's locations and filed for bankruptcy in May, blaming Dine Brands' "ill-advised and value-destroying" decisions for struggling sales and millions of wasted dollars.

The franchisee filed for bankruptcy at 3:30 a.m. on May 8, hours after Dine Brands' CEO issued an ultimatum: send $12 million in unpaid royalties by the end of the day, or lose your restaurants.

Dine Brands claims that RMH owes the company more than $23 million in unpaid and lost future royalties and other fees.

There's a battle raging within Applebee's.

On one side is the chain's parent company, Dine Brands. On the other is Applebee's second-largest franchisee, RMH Holdings, which filed for bankruptcy earlier this year — at 3:30 a.m. on Tuesday, May 8, to be exact.

The bankruptcy filing came hours after a fateful phone call on Monday afternoon between Dine Brands CEO Steve Joyce and RMH representatives.

In the phone call, which is said to have lasted less than five minutes, Joyce said that if the franchisee didn't wire Dine Brands $12 million by the end of the day, dozens of the franchisee's stores would be shut down, according to three people with knowledge of RMH's thinking on the matter.

RMH said it was a shocking ultimatum, with one source with direct knowledge of the conversation calling it the equivalent of "having a nuclear bomb dropped on your head." This person asked to remain anonymous to be able to speak frankly about the situation. ...