Appellants appeal the final judgment of the Circuit Court of Jackson County dismissing their Amended Petition on the grounds that the trial court could not exercise its authority1 due to the prior filing of identical claims in another case in Kansas and as a result the improper splitting of a cause of action. We affirm in part and reverse in part.
Factual Background
On December 14, 2009, Great Southern Bank filed suit in the District Court of Johnson County, Kansas against Waterford Glen, LLC (“Waterford”) seeking to foreclose on a mortgage, for breach of contract and other relief. That suit also named Farmers Bank (“Farmers”) as a defendant, as it held a junior mortgage on the same property (“Kansas Action”).2 In *825that suit, Farmers filed a cross-petition against Waterford to foreclose on its claimed mortgage against Waterford and also filed a third party petition against Barney Ashner Homes, Inc. (BAHI), Woodbridge Crossing, LLC (“Wood-bridge”), Somerset Gardens, LLC (“Somerset”), Brenda and Daniel Waldberg, and Marlene and Barney Ashner, seeking judgment on certain notes and guarantees. These third parties also filed counterclaims and cross-claims against Farmers Bank in the Kansas Action.
Plaintiff Original Third Party Defendants
Great Southern v. Waterford v. BAHI Woodbridge Bank Farmers Somerset B & D Waldberg M & B Ashner
On February 26, 2010, BAHI, Waterford, Woodbridge, Somerset, Marlene and Barney Ashner, Daniel and Brenda Wald-berg, and Heartland Builders, LLC (“Heartland”) (collectively “Appellants”) filed suit against Farmers and D & D Client Services, Inc. (“D & D”) (“collectively “Respondents”) in the Circuit Court of Jackson County, Missouri (“Missouri Action”). This suit included two parties, Heartland (a plaintiff) and D & D (a defendant), which were not parties to the Kansas Action. The Appellants’ petition sought equitable relief, damages for breach of contract, promissory estoppel, declaratory judgment, breach of good faith and fair dealing, accounting, fraud, negligent representation, and breach of fiduciary duty.
Plaintiff (Appellants) Defendants
BAHI v. Farmers Waterford D & D (new party not in KS action)
Woodbridge
Somerset
B & D Waldberg
M & B Ashner
Heartland (new party not
in KS action)
Farmers filed a Motion to Dismiss, which D & D joined, arguing that Appellants’ claims for damages are barred under the first-filed rule and the prohibition against splitting a cause of action, and that Appellants’ equitable claims were moot. The Circuit Court granted the Motion to Dismiss, finding that Appellants’ had conceded the counts requesting equitable relief were moot because the foreclosure sale that they had sought to avoid had already occurred. The trial court also found that the Kansas Action and Missouri Action claims are identical and that the fact that Heartland and D & D are not part of the Kansas Case and that most of the Plaintiffs in the Missouri Action are Third-Party Defendants in the Kansas Action is irrelevant. Accordingly, the trial court found that Appellants’ claims for damages were prohibited under the first-filed rule and the prohibition against splitting a cause of action. Appellants now appeal.
The trial court granted Farmers’s and D & D’s Motion to Dismiss but relied on documents outside the pleadings to do so.
Analysis
Before we can address the substantive arguments on appeal, we must first consider the procedure followed in this case. Respondents attached to their Motion to Dismiss matters outside the pleadings, and it is clear that the trial court considered exhibits outside the pleadings in granting Respondents’ Motion to Dismiss. (For example the trial court in its Judgment refers to a chart submitted by Respondents detailing the claims in the Missouri action as being identical to the counterclaims in the Kansas action. While such a chart may just be used as a demonstrative exhibit to enhance the arguments made in the motion, the Kansas pleadings from which the information in *826the chart was obtained were outside of the Missouri pleadings.)
“In ruling on a motion to dismiss, the trial court can only consider the pleadings, and appellate review is also limited to the pleadings.” Walters Bender Strohbehn & Vaughan, P.C. v. Mason, 316 S.W.3d 475, 479 (Mo.App. W.D.2010) (quoting L.C. Dev. Co. v. Lincoln County, 26 S.W.3d 336, 339 (Mo.App. E.D.2000)). However, Rule 55.27(a) provides that
If, on a motion asserting the defense numbered (6) to dismiss for failure of the pleading to state a claim upon which relief can be granted, matters outside the pleadings are presented to and not excluded by the court, the motion shall be treated as one for summary judgment and disposed of as provided in Rule 74.04. All parties shall be given reasonable opportunity to present all material made pertinent to such a motion by Rule 74.04.
“[T]he rule against splitting a cause of action is a form of claim preclusion or res judicata.” Shores v. Express Lending Services, Inc., 998 S.W.2d 122, 127 (Mo.App. E.D.1999) (citing Evans v. St. Louis Comprehensive Neighborhood Health Ctr., 895 S.W.2d 124, 126 (Mo.App. E.D.1995)). The arguments made by the Respondents that the fírst-to-file rule and the doctrine of claim splitting prevented the court from proceeding on this cause are essentially arguments that the Appellants have failed to state a claim upon which relief may be granted. See King Gen. Contractors, Inc. v. Reorganized Church of Jesus, 821 S.W.2d 495, 498 (Mo. banc 1991) (“While not expressly stated in the Rule, defenses of res judicata and issue preclusion are in essence defenses alleging the plaintiff has failed to state a claim upon which relief may be granted.”) Accordingly, to grant the Motion to Dismiss the trial court must necessarily have treated the Motion to Dismiss as a motion for summary judgment.
Rule 55.27(a) requires that notice be given to all parties that the trial court is treating the motion to dismiss as one for summary judgment and the court must give all parties a reasonable opportunity to present all material pertinent to the motion. Walters Bender Strohbehn & Vaughan, P.C., 316 S.W.3d at 480. “When the opposing party does ‘not acquiesce in treating the motion as one for summary judgment,’ the trial court’s failure to provide such notice requires reversal.” Id. (quoting Gregg v. City of Kansas City, 272 S.W.3d 353, 363-64 (Mo.App. W.D.2008)). From the record and oral argument, it is clear that the trial court provided no notice to the parties that it was treating Respondents’ Motion to Dismiss as one for summary judgment. Therefore, the judgment cannot stand.
In addition, while Respondents did attempt to raise an affirmative defense in its answer that states, “Plaintiffs fail to state a claim upon which relief can be granted,” such a legal conclusion is insufficient as a matter of law. Am. First Fed., Inc. v. Battlefield Ctr., L.P., 282 S.W.3d 1, 7 (Mo.App. E.D.2009). “An affirmative defense is properly raised where the defendant asserts clearly and precisely additional facts which serve to avoid the defendant’s legal responsibility even though the plaintiffs allegations are sustained by the evidence.” Id. (emphasis added, internal citations omitted.) A proper affirmative defense must state the factual basis for the defense in the same fashion required for pleading a claim, and bare assertions of a legal conclusion fail to satisfy the require-ments of Rule 55. Id. at 7-8. Clearly, the legal conclusion stated in Respondents’ affirmative defenses are insufficient to preserve their claims regarding the first-to-file rule and the doctrine of claim splitting. *827Summary judgment cannot be sustained on grounds not properly raised in the pleadings. Glasgow Enterprises, Inc. v. Bowers, 196 S.W.3d 625, 630 (Mo.App. E.D.2006).
Finally, Respondents assert that Appellants’ claims for equitable relief, raised as Count’s Eight, Nine and Ten of their Petition in the Missouri Action, are moot and there was no error in dismissing those claims. Appellants’ Count Eight asserts a theory of estoppel to stop the foreclosure of certain deeds of trust. Count Nine seeks a preliminary injunction to enjoin the foreclosure of certain properties subject to the deeds of trust addressed in Count Eight. Count Ten seeks a permanent injunction barring the foreclosures addressed in Counts Eight and Nine. The trial court found, and the Appellants conceded, that these counts should be dismissed because the foreclosure sales on the property had previously occurred. Appellants do not challenge this finding on appeal. Therefore, the judgment of the trial court dismissing Counts Eight, Nine, and Ten of the Appellants Petition filed in the Missouri Action is affirmed.
Conclusion
The judgment of the circuit court, dismissing Appellants’ Counts One through Seven of the Amended Petition is reversed. The judgment of the circuit court, dismissing Appellants’ Counts Eight through Ten of the Amended Petition is affirmed. This cause is remanded for further proceedings consistent with this opinion.
All concur.