
924 N.E.2d 1103 (2009)
395 Ill. App.3d 870
Roger R. KASNY, Plaintiff-Appellant,
v.
COONEN AND ROTH, LTD., n/k/a Roth, Melei, Santeler, Ltd., Defendant-Appellee.
No. 2-08-0220.
Appellate Court of Illinois, Second District.
November 13, 2009.
*1105 Thomas W. Gooch III, Michael J. Gauthier, Law Offices of Thomas W. Gooch, III, Wauconda, IL, for Roger R. Kasny.
John J. Duffy, Karen Kies DeGrand, Edward E. Fu, Donohue, Brown, Mathewson & Smyth LLC, Chicago, IL, for Coonen & Roth, Ltd.
Justice McLAREN delivered the opinion of the court:
Plaintiff, Roger R. Kasny, appeals the dismissal of his legal malpractice claim against defendant, Coonen & Roth, Ltd., n/k/a Roth, Melei, Santeler, Ltd. Plaintiff contends that a small claims judgment for outstanding attorney fees entered in defendant's favor does not bar his legal malpractice case. We reverse and remand.
In 2002, plaintiff retained defendant to represent him in the dissolution of his marriage. Plaintiff signed an engagement agreement with defendant, whereby plaintiff agreed to pay defendant reasonable fees for necessary work done and to work toward reconciliation. Plaintiff and his ex-wife eventually executed a marital settlement agreement, and plaintiff failed to pay defendant for its services. Defendant sued plaintiff in small claims court for outstanding legal fees totaling $4,955.15. Plaintiff never appeared in small claims court to defend against the breach of contract action. A judgment for the unpaid legal fees plus costs was entered in defendant's favor on April 13, 2006.
In 2007, plaintiff sued defendant for breach of contract and legal malpractice. Although the trial court dismissed plaintiff's breach of contract claim with prejudice, it dismissed plaintiff's legal malpractice claim without prejudice, and plaintiff filed an amended complaint. In plaintiff's amended complaint, in which he claimed at least $200,000 in damages, he alleged that defendant: failed to appraise various marital assets and relied on the inaccurate appraisals that plaintiff's ex-wife prepared; did not discover plaintiff's ex-wife's nonmarital assets and understand the impact that her nonmarital real property could have on a fair division of the marital property; neglected to promptly and properly answer discovery; allowed the dissolution case to continue for more than three years with little or no work done toward resolving the matter; violated discovery rules, for example by failing to disclose expert witnesses who could testify about the value of various marital assets, which violations resulted in plaintiff's inability to proceed with a trial; failed to advise plaintiff that he could not proceed with a trial because of the discovery violations; and induced plaintiff to settle the case by telling plaintiff that appraisals were too expensive, that his own appraisals would not alter the *1106 valuation of the property, and that he had no choice but to agree to a settlement. Plaintiff asserted that he was unaware of a cause of action for legal malpractice against defendant until sometime in June 2006, two months after the small claims case was resolved, when the malpractice attorney he contacted had adequately investigated plaintiff's case.
Defendant moved to dismiss plaintiff's amended complaint, arguing that the judgment for unpaid legal fees entered in the small claims case barred plaintiff from bringing a cause of action for legal malpractice. Defendant asserted that plaintiff's lack of knowledge of a legal malpractice claim was no defense, as he could have discovered a cause of action for legal malpractice had he exercised due diligence. The trial court granted defendant's motion to dismiss, finding that professional negligence is a defense to a claim for outstanding attorney fees and that, thus, plaintiff should have raised the issue of legal malpractice in the small claims case. This timely appeal followed.
At issue in this case is whether defendant's motion to dismiss plaintiff's complaint for legal malpractice was properly granted. More specifically, we consider whether the judgment for outstanding attorney fees entered in the small claims case has res judicata effect in plaintiff's action for legal malpractice.
A motion to dismiss pursuant to section 2-619 of the Code of Civil Procedure (735 ILCS 5/2-619 (West 2006)) admits all well-pleaded facts, the reasonable inferences to be drawn from those facts, and the legal sufficiency of the complaint; but it asserts affirmative matter to avoid or defeat the claim. Floyd v. Rockford Park District, 355 Ill.App.3d 695, 704, 291 Ill.Dec. 418, 823 N.E.2d 1004 (2005). When ruling on a motion to dismiss, the trial court must interpret all pleadings and supporting documents in a light most favorable to the nonmoving party. Lucas v. Taylor, 349 Ill.App.3d 995, 998, 285 Ill.Dec. 483, 812 N.E.2d 72 (2004). We review de novo the dismissal of the amended complaint. Stahelin v. Forest Preserve District of Du Page County, 376 Ill.App.3d 765, 771, 315 Ill.Dec. 792, 877 N.E.2d 1121 (2007).
One defense that a defendant may raise in a section 2-619 motion is that a prior judgment bars the plaintiff's cause of action, i.e., that the prior judgment has res judicata effect in the subsequent lawsuit. 735 ILCS 5/2-619(a)(4) (West 2006). "The doctrine of res judicata provides that a final judgment on the merits rendered by a court of competent jurisdiction is conclusive as to the rights of the parties and their privies, and as to them constitutes an absolute bar to a subsequent action involving the same claim, demand, or cause of action." City of Rockford v. Unit Six of the Policemen's Benevolent & Protective Ass'n, 362 Ill.App.3d 556, 560-61, 298 Ill.Dec. 848, 840 N.E.2d 1283 (2005). Res judicata applies if (1) there was a final judgment on the merits rendered by a court of competent jurisdiction; (2) there is an identity of causes of action; and (3) there is an identity of parties or their privies. Yorulmazoglu v. Lake Forest Hospital, 359 Ill.App.3d 554, 558, 295 Ill. Dec. 887, 834 N.E.2d 468 (2005). The party seeking to invoke res judicata bears the burden of demonstrating that it applies (Cload v. West, 328 Ill.App.3d 946, 950, 263 Ill.Dec. 35, 767 N.E.2d 486 (2002)), and the doctrine bars not only all claims actually resolved in the former suit, but also any claims that could have been raised (In re Marriage of Kohl, 334 Ill.App.3d 867, 879-80, 268 Ill.Dec. 547, 778 N.E.2d 1169 (2002)).
The parties agree that the judgment for outstanding fees represents a final judgment *1107 on the merits rendered by a court of competent jurisdiction and that there is an identity of parties in both cases. However, they disagree about whether there is an identity of causes of action between the malpractice cause and the small claims cause.
In considering whether there is an identity of causes of action in this case and the small claims case, we note that, "in Illinois, counterclaims are generally permissive rather than mandatory." Corcoran-Hakala v. Dowd, 362 Ill.App.3d 523, 530, 298 Ill.Dec. 516, 840 N.E.2d 286 (2005). "Thus, a defendant [in the original action] generally may raise his or her claim against the plaintiff [in the original action] by way of a counterclaim or by way of a separate action." Dowd, 362 Ill. App.3d at 530-31, 298 Ill.Dec. 516, 840 N.E.2d 286. "However, if the defendant's claim involves the same operative facts as the plaintiff's claim, res judicata may bar the defendant from raising his or her claim in a subsequent action." Dowd, 362 Ill. App.3d at 531, 298 Ill.Dec. 516, 840 N.E.2d 286. "Specifically, res judicata bars a subsequent action if successful prosecution of that action would in effect nullify the judgment entered in the initial action." Dowd, 362 Ill.App.3d at 531, 298 Ill.Dec. 516, 840 N.E.2d 286.
Illinois cases are split on the issue of whether an attorney's claim for fees and a client's claim for malpractice are a single cause of action. In Bennett v. Gordon, 282 Ill.App.3d 378, 383-84, 217 Ill.Dec. 924, 668 N.E.2d 109 (1996), the First District held that they were. Plaintiff, on the other hand, relies on Wilson v. M.G. Gulo & Associates, Inc., 294 Ill.App.3d 897, 229 Ill.Dec. 402, 691 N.E.2d 875 (1998), in which the Third District held to the contrary. See also Weisman v. Schiller, Ducanto & Fleck, 314 Ill.App.3d 577, 581, 248 Ill.Dec. 143, 733 N.E.2d 818 (2000) (First District declines to follow Bennett). However, in River Park, Inc. v. City of Highland Park, 184 Ill.2d 290, 316, 234 Ill.Dec. 783, 703 N.E.2d 883 (1998), the supreme court cited Bennett with approval, and in Dowd, this court stated its belief "that Wilson was wrongly decided." Dowd, 362 Ill.App.3d at 529, 298 Ill.Dec. 516, 840 N.E.2d 286. Thus, at least in this district, the law is settled that these claims indeed are the same cause of action, such that ordinarily a counterclaim is mandatory. See Dowd, 362 Ill.App.3d at 530-31, 298 Ill.Dec. 516, 840 N.E.2d 286.
This is not to say, however, that res judicata necessarily applies. As noted, the doctrine bars only those claims that could have been raised. Indeed, res judicata extends only to claims that "`could have been presented by the exercise of due diligence.'" (Emphasis added.) Hughey v. Industrial Comm'n, 76 Ill.2d 577, 582, 31 Ill.Dec. 787, 394 N.E.2d 1164 (1979), quoting 46 Am. Jur. 2d Judgments § 417, at 585-86. Citing Hughey, defendant asserts that "the relevant inquiry is not whether the litigant knew of a claim, but rather whether the claim[ ] existed at the time of the prior proceeding and therefore could have been raised by exercising due diligence." (Emphases in original.) However, the mere fact that a claim exists does not establish that a litigant exercising due diligence would discover it. If a claim exists and the litigant does not discover it despite his due diligence, res judicata does not apply. This principle is perfectly consistent with the notion that res judicata, at its core, is a doctrine of equity, not law. See City of Chicago v. Midland Smelting Co., 385 Ill.App.3d 945, 963, 324 Ill.Dec. 578, 896 N.E.2d 364 (2008) ("res judicata is an equitable doctrine that should only be applied as fairness and justice require").
*1108 Here, plaintiff alleged that he "did not learn of the existence of a cause of action for legal malpractice and consequently could not file such action until at the earliest * * * well after Defendants [sic] had sued [plaintiff] and successfully obtained a default judgment for fees." He further alleged that he did not, and could not, discover his malpractice claim "until after consulting with an attorney experienced in legal malpractice matters and * * * until that attorney had adequate time to investigate and opine on the existence of a legal malpractice matter after sufficient due diligence so as not to run afoul of [Supreme Court] Rule 137, in the proper investigation of facts and law prior to opining and the preparation of a suitable complaint." That is, plaintiff alleged that, through the exercise of due diligence, he could not have raised his malpractice claim as a counterclaim in defendant's small claims case. Taking these allegations as true and reading them liberally, as we must at this stage, we hold that defendant has failed to establish the applicability of res judicata.
The cases on which defendant relies are easily distinguishable. In Singer v. Steven Kokes, Inc., 39 Md.App. 180, 384 A.2d 463 (1978), the plaintiffs sued to recover for the defendant's alleged breach of warranty and negligence in constructing a house. The defendant claimed res judicata. In a prior suit, the defendant had sought to foreclose a mechanic's lien, and the plaintiffs had alleged 57 defects as a credit against the lien. The plaintiffs attempted to avoid res judicata by claiming that they had not known of the 141 additional defects that supported their present suit. In affirming summary judgment for the defendant, the appellate court held that the plaintiffs "could not avoid the entry of summary judgment by merely alleging they had no knowledge of the defects. Rather, they were required to have shown also that the defects could not have been discovered with reasonable diligence." Singer, 39 Md.App. at 185, 384 A.2d at 467; see also Badger v. Badger, 69 Utah 293, 301, 254 P. 784, 787 (1927) ("In the amended petition which was stricken there is no allegation that [the petitioner] did not have the same knowledge * * * at the time she filed her first petition"). Here, of course, plaintiff did not allege merely that during the small claims case he had no knowledge of his malpractice claim. Rather, he alleged that through the exercise of reasonable diligence he could not have discovered it in time to raise it there.
Defendant asserts that due diligence "would have required [plaintiff] to at least appear at the [small claims] hearing to contest his liability. Had he appeared and responded to the fee litigation, [plaintiff] could have learned of the purported legal malpractice and should have raised the claim at that time." Defendant notes also that plaintiff could have sought to take discovery to realize his claim. See 145 Ill.2d R. 287(a) (no discovery in small claims except by leave of court). "Instead, [plaintiff] simply ignored the fee litigation."
Defendant here raises only a question of fact. In light of plaintiff's allegations, we cannot necessarily attribute his default in the small claims case to a lack of diligence in exploring his defenses. Small claims proceedings are designed to be expedient (Tannenbaum v. Fleming, 234 Ill.App.3d 1041, 1044, 175 Ill.Dec. 567, 600 N.E.2d 498 (1992)), such that plaintiff might have diligently investigated but determined that, as of then, he simply had no defense to offer. To the extent he had any inkling of malpractice, he would not necessarily have been unreasonable for failing to rely on the prospect of small claims discovery, which he could not conduct as a matter of right, to flesh it out. While a small claims *1109 defendant cannot use the expediency of the proceeding as a shield if he has truly failed to be diligent, the small claims plaintiff cannot use it as a sword if the defendant, despite his diligence, is unable to marshal a counterclaim in time.[1]
A section 2-619 motion may not be granted when the asserted defense requires the resolution of a material fact before it is proven. Reilly v. Wyeth, 377 Ill.App.3d 20, 36, 315 Ill.Dec. 428, 876 N.E.2d 740 (2007). Here, plaintiff alleged that he was duly diligent, and defendant alleged otherwise. Diligence is generally a question of fact (In re Application of the County Collector, 219 Ill.App.3d 396, 404, 162 Ill.Dec. 122, 579 N.E.2d 936 (1991)), and it certainly is here. Thus, res judicata has not been proven, and the trial court erred in granting defendant's motion.
The judgment of the circuit court of McHenry County is reversed, and this cause is remanded for further proceedings.
Reversed and remanded.
BURKE and HUDSON, JJ., concur.
NOTES
[1]  Indeed, some authority suggests that res judicata is inapplicable precisely because plaintiff did not appear in the small claims case. See Restatement (Second) of Judgments § 22, Comment a, at 186 (1982) ("Even in jurisdictions having a statute or rule making certain counterclaims compulsory, such provisions may not apply when no answer or other responsive pleading is filed"); Restatement (Second) of Judgments § 22, Illustration 2, at 186 (1982) ("A, a physician, brings an action against B for the price of medical services rendered to B. B fails to plead and judgment by default is given against him. B is not precluded from subsequently maintaining an action against A for malpractice relating to the services sued upon in the prior action"). Plaintiff does not make this argument, however, and thus we do not address it.
