
876 N.E.2d 1096 (2007)
EIGHTEEN INVESTMENTS, INC., Plaintiff-Appellant,
v.
NATIONSCREDIT FINANCIAL SERVICES CORP., Defendant-Appellee.
No. 1-06-3122.
Appellate Court of Illinois, First District, First Division.
September 28, 2007.
*1097 Marcus Perres & Boxerman, LLP, Chicago (Michael J. Boxerman, of counsel), for Appellant.
Dykema Gossett PLLC, of Chicago (Rosa M. Tumialán and Julie C. Keller, of counsel), for Appellee.
*1098 Justice ROBERT E. GORDON delivered the opinion of the court:
Defendant NationsCredit Financial Services Corp. foreclosed on a mortgage on a residential property, and plaintiff Eighteen Investments, Inc., purchased the property at the judicial sale for $100,000. The circuit court of Cook County entered an order confirming the sale on March 14, 2002.
However, there were problems with title: the mortgage listed the wrong property index number (PIN) and the wrong lot number; the deed from the judicial sale also listed the wrong lot number; and a release for the mortgage had already been recorded. Plaintiff then filed a motion in the foreclosure action to vacate the judicial order confirming the sale on the ground that the mortgage had already been released. The trial court denied the motion.
On January 13, 2005, plaintiff then filed the complaint in this action alleging unjust enrichment, as well as claims for rescission and declaratory judgment. The trial court granted summary judgment for the defendant on the unjust enrichment claim and dismissed the remaining claims on the grounds of res judicata and collateral estoppel. For the reasons discussed below, the judgment of the trial court is affirmed.

BACKGROUND
Eighteen Investments is a Missouri corporation that purchases commercial and residential investment properties, including foreclosure properties. NationsCredit is a North Carolina corporation that was formerly a subsidiary of NationsBank Corporation and is now a subsidiary of Bank of America Corporation. NationsCredit issues real estate loans directly to applicants purchasing residential properties, and also purchases real estate loan pools from other lenders.
The subject property is located at 2644 West Adams Street, Chicago, Illinois. The correct PIN is XX-XX-XXX-XXX, and the correct lot number is 36. The incorrect PIN listed on the subject mortgage was XX-XX-XX-XXX (missing a "9"), and the incorrect lot number listed on both the subject mortgage and judicial sale deed was 16 (with a "1" instead of a "3").
On July 23, 1999, the Greater Midwest Real Estate Group sold the property to Eric Pollards in a deed that listed the wrong lot number, lot 16, instead of 36. On the same day, Pollards executed the subject mortgage for the benefit of the defendant which, as previously noted, listed both the wrong lot number and the wrong PIN. Defendant also purchased title insurance from First American Title Insurance Company.
On October 15, 1999, a release for this mortgage was recorded. In its brief to this court, defendant claimed that the trial court in the foreclosure action found this release to be a forgery and void. However, it is not clear from the record that the foreclosure court made such a finding. The foreclosure court's order dated May 1, 2003, denied plaintiff's motion to vacate "pursuant to the Court's ruling as read into the record this 1st day of May, 2003." The transcript of the proceedings was not made part of the appellate record, so we do not know what the foreclosure court "read into the record" on May 1. The parties must have been unclear as well, since plaintiff subsequently filed a motion to clarify by declaring the release "null and void." However, the appellate record does not contain such a declaration. At the summary judgment hearing in this action, the trial court stated that the "release is off the table" since the foreclosure court had declined to enforce the release; and in response, plaintiff's attorney disputed that the foreclosure court had made "a specific *1099 finding as to whether or not the release was valid." Thus, despite defendant's declaration in its appellate brief that the release was a forgery, that fact is not established by the record filed on appeal.[1]
On October 15, 1999, the same day that the release was recorded, Pollards executed a mortgage for the benefit of Funding Network, Inc. On March 20, 1999, Pollards conveyed the subject property to Percy Doss, and Doss executed a mortgage for the benefit of Creve Coeur Mortgage Associates. On July 7, 2000, Creve Coeur assigned the Doss mortgage to First Union.
The deed to Doss, the Doss mortgage and the assignment to First Union all listed the wrong lot number, lot 16. However, on January 9, 2001, Creve Coeur re-recorded its mortgage with the incorrect lot number crossed out and the correct lot number inserted in its place. On January 10, 2001, Creve Coeur did the same for the assignment to First Union.
On March 19, 2001, Betty Hinton purchased the subject property at a judicial sale, after First Union foreclosed on the Doss mortgage. On August 9, 2001, Hinton conveyed the property to her grandson, Kenyatta Land. The deed to Hinton used both the correct lot number and the correct PIN.
On June 13, 2001, defendant filed a complaint to foreclose the subject mortgage. The mortgage foreclosure action included as parties Doss and First Union, but not Betty Hinton or Kenyatta Land. On February 8, 2002, plaintiff purchased the subject property at a judicial sale for $100,000. On March 14, 2002, the foreclosure court entered an order confirming the sale. Both the deed from the judicial sale and the order confirming the sale listed the wrong lot number.
On April 15, 2002, plaintiff filed a motion in the foreclosure action to vacate the order approving the sale. In the motion, plaintiff claimed that after the order was entered confirming the sale, a visit to the subject property disclosed that Land was living there and claimed to be the owner. After receiving this information, plaintiff reviewed the real property records and found the release of the subject mortgage. Plaintiff's motion claimed the order should be vacated on the grounds of the prior release and defendant's failure to name other parties who had an interest in the subject property; however, the motion made no mention of the incorrect lot number or PIN. After an evidentiary hearing, the motion was denied in an order dated May 1, 2003.
On January 13, 2005, plaintiff filed the complaint in this action seeking to recover the $100,000 it had paid to defendant. The complaint alleged four counts: count I, rescission based on mutual mistake; count II, unjust enrichment; count III, rescission based on fraud; and count IV, a declaratory judgment that plaintiff had a superior claim to title over any other party. The basis for these counts was the incorrect lot number and PIN. The named defendants included Land, Hinton, Pollards and First American Title Company. However, Land, Pollards and Hinton were never served with a summons and complaint; and plaintiff voluntarily dismissed First American Title Company without prejudice.
Defendant moved to dismiss pursuant to section 2-619 of the Code of Civil Procedure (Code) (735 ILCS 5/2-619 (West 2006)) based on res judicata and collateral *1100 estoppel, claiming that the foreclosure court's denial of plaintiff's motion to vacate barred this subsequent action. On June 17, 2005, the trial court granted the motion with respect to all counts but count II, the unjust enrichment claim.
After discovery was complete, the parties filed a joint statement of stipulated facts, as well as separate motions for summary judgment. On September 28, 2006, after argument by counsel, the trial court granted defendant's motion for summary judgment and denied plaintiff's motion. The trial court's written order also stated that "[p]laintiff non-suits its claims against [d]efendants Kenyatta Land, Eric Pollard, [and] Betty Hinton."
Plaintiff appeals both the trial court's prior dismissal of counts I, III and IV, as well as its subsequent grant of defendant's summary judgment motion For the reasons discussed below, we affirm.

ANALYSIS
Plaintiff claims that the trial court erred in dismissing counts I, III and IV on res judicata and collateral estoppel grounds because this action is based on the wrong PIN and lot numbers, while the prior motion to vacate was based on the mortgage release. Plaintiff also claims that the trial court erred in granting summary judgment on plaintiff's unjust enrichment since plaintiff received an allegedly worthless deed and defendant could make a claim on its title insurance policy. The standard of review on appeal for both the dismissal and summary judgment motions is de novo. Solaia Technology, LLC v. Specialty Publishing Co., 221 Ill.2d 558, 579, 304 Ill.Dec. 369, 852 N.E.2d 825 (2006) (under section 2-619, "our standard of review is de novo") Ramirez v. Smart Corp., 371 Ill.App.3d 797, 801, 309 Ill.Dec. 168, 863 N.E.2d 800 (2007) ("When a trial court grants summary judgment, we review de novo").

Section 2-619 Dismissal Motion
The trial court properly granted defendant's dismissal motion. The Illinois Supreme Court has stated that "[a] motion to dismiss, pursuant to section 2-619 of the Code, admits the legal sufficiency of the plaintiffs' complaint, but asserts an affirmative defense or other matter that avoids or defeats the plaintiff's claim." DeLuna v. Burciaga, 223 Ill.2d 49, 59, 306 Ill.Dec. 136, 857 N.E.2d 229 (2006); Solaia Technology v. Specialty Publishing Co., 221 Ill.2d 558, 579, 304 Ill.Dec. 369, 852 N.E.2d 825 (2006).
A section 2-619 motion is permitted only on nine listed grounds:
"(1) That the court does not have jurisdiction of the subject matter of the action, provided that the defect cannot be removed by a transfer of the case to a court having jurisdiction.
(2) That the plaintiff does not have a legal capacity to sue or that the defendant does not have the legal capacity to be sued.
(3) That there is another action pending between the same parties for the same cause.
(4) That the cause of action is barred by a prior judgment.
(5) That the action was not commenced within the time limited by law.
(6) That the claim set forth in the plaintiff's pleading has been released, satisfied of record, or discharged in bankruptcy.
(7) That the claim asserted is unenforceable under the provisions of the Statute of Frauds.
(8) That the claim asserted against defendant is unenforceable because of his or her minority or other disability.

*1101 (9) That the claim asserted against defendant is barred by other affirmative matter avoiding the legal effect of or defeating the claim." 735 ILCS 5/2-619(a) (West 2006).
In the case at bar, the subject matter of defendant's dismissal motion falls into one of the categories permitted by section 2-619: "(4) That the cause of action is barred by a prior judgment." 735 ILCS 5/2-619(a)(4) (West 2006). In its order dated June 17, 2005, the trial court dismissed Counts I, III and IV of the complaint pursuant to section 2-619 without stating the reasons for the dismissal. However, defendant had moved to dismiss on the ground that the prior foreclosure judgment barred the complaint, based on the doctrines of res judicata and collateral estoppel. Thus, the limitations of section 2-619 are satisfied.
Dismissal based on res judicata was proper. "The doctrine of res judicata provides that a final judgment rendered by a court of competent jurisdiction on the merits 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." Nowak v. St. Rita High School, 197 Ill.2d 381, 389, 258 Ill.Dec. 782, 757 N.E.2d 471 (2001); Arvia v. Madigan, 209 Ill.2d 520, 533, 283 Ill.Dec. 895, 809 N.E.2d 88 (2004). "For the doctrine of res judicata to apply, the following three requirements must be satisfied: (1) there was a final judgment on the merits rendered by a court of competent jurisdiction, (2) there is an identity of cause of action, and (3) there is an identity of parties or their privies." River Park, Inc. v. City of Highland Park, 184 Ill.2d 290, 302, 234 Ill.Dec. 783, 703 N.E.2d 883 (1998). In the case at bar, there is no dispute that the foreclosure court was a court of competent jurisdiction, that it rendered a final judgment and that the identical parties in this action were also parties in the prior action. Thus, the only issue with respect to res judicata is whether the two actions involved the same cause of action.
The bar with respect to the same cause of action is "designed to prevent a multiplicity of lawsuits between the same parties where the facts and the issues are the same." Dalan/Jupiter, Inc. v. Draper & Kramer, Inc., 372 Ill.App.3d 362, 369, 310 Ill.Dec. 118, 865 N.E.2d 442 (2007). It "promotes judicial economy" and "protects parties" from being forced to relitigate "essentially the same case." Arvia, 209 Ill.2d at 533, 283 Ill.Dec. 895, 809 N.E.2d 88. "Simply stated," it "prevents a party from taking two bites out of the same apple." Arvia, 209 Ill.2d at 534, 283 Ill. Dec. 895, 809 N.E.2d 88.
To determine whether causes of action are the same, the Illinois Supreme Court adopted the transactional test in River Park, 184 Ill.2d at 310-11, 234 Ill.Dec. 783, 703 N.E.2d 883. The Supreme Court held that "separate claims will be considered the same cause of action for purposes of res judicata if they arise from a single group of operative facts, regardless of whether they assert different theories of relief." River Park, 184 Ill.2d at 311, 234 Ill.Dec. 783, 703 N.E.2d 883. The Supreme Court stated that "the transactional test permits claims to be considered part of the same cause of action even if there is not a substantial overlap of evidence, so long as they arise from the same transaction." River Park, 184 Ill.2d at 311, 234 Ill.Dec. 783, 703 N.E.2d 883.
Plaintiff's claims in this case are barred because they arise from the "same transaction" as the claim raised in its prior motion to vacate in the mortgage foreclosure action. The transaction which gave birth to both was the judicial sale, at which plaintiff purchased the subject property.
*1102 Nonetheless, plaintiff claims that the "operative facts" in the two actions are different, because in the prior action it chose to move only on the basis of the mortgage release, while in this action it has chosen to move only on the basis of the wrong PIN and lot numbers. However, the Illinois Supreme Court has held that doctrine of res judicata "extends to all matters, that were offered to sustain or defeat the claim in the first action, as well as all matters that could have been offered for that purpose." Arvia, 209 Ill.2d at 533, 283 Ill.Dec. 895, 809 N.E.2d 88; see also Dalan/Jupiter, 372 Ill.App.3d at 367, 310 Ill.Dec. 118, 865 N.E.2d 442.
Plaintiff could have offered the wrong PIN and lot number as a basis to defeat the claim in the first action, but it failed to do so. As plaintiff's attorney candidly admitted during oral argument on the summary judgment motion, the wrong numbers were "an issue that wasn't raised that should have been raised" in the first action.[2] Plaintiff's failure to offer all the possible facts in the first action that could have vacated the judicial sale does not give plaintiff another "bite at the apple." Dalan/Jupiter, 372 Ill.App.3d at 368, 310 Ill. Dec. 118, 865 N.E.2d 442. Thus, the trial court was correct in dismissing counts I, III and IV since they were barred by the doctrine of res judicata.
Like the case at bar, in Mountain States Mortgage Center, Inc. v. Allen, 257 Ill. App.3d 372, 195 Ill.Dec. 588, 628 N.E.2d 1052 (1993), the doctrine of res judicata was applied to a judicial sale. In Mountain States, the plaintiff claimed that its mortgage had priority over the defendant's mortgage. The trial court denied plaintiff's claim, held that the defendant was the primary creditor and entered a judgment of foreclosure. Mountain States, 257 Ill.App.3d at 375, 195 Ill.Dec. 588, 628 N.E.2d 1052. Subsequently, plaintiff filed an amended complaint claiming that it was the primary creditor based on an entirely different set of facts, namely that it held yet another mortgage on the same property. Mountain States, 257 Ill.App.3d at 375, 195 Ill.Dec. 588, 628 N.E.2d 1052. The appellate court held that pursuant to the doctrine of res judicata, the amended complaint represented a second bite at the same apple and was thus barred. Mountain States, 257 Ill.App.3d at 382-83, 195 Ill.Dec. 588, 628 N.E.2d 1052. Similarly, in the case at bar, raising the wrong PIN and lot number was simply a second attempt by plaintiff to undo the same judicial sale based on facts that could have been raised previously but were not.
Since the trial court's dismissal order was proper based on res judicata, this court need not address collateral estoppel, which was an alternative basis put forth by the defendant in support of the dismissal order.

Summary Judgment Motion
The trial court properly granted defendant's motion for summary judgment on plaintiff's unjust enrichment claim. When reviewing a grant of summary judgment, this court has recently stated:
"Summary judgment is a drastic method of disposing of litigation. It is proper only when the pleadings, depositions, and admissions clearly demonstrate that there are no genuine issues of material fact and the moving party is entitled to judgment as a matter of law. [Citation.] In reviewing an order for *1103 summary judgment, all of the facts must be viewed in a light most favorable to the nonmoving party. [Citation.] Thus, on examination of the record, if it can be fairly stated that a triable issue of fact exists, the motion should be denied." Ramirez, 371 Ill.App.3d at 801, 309 Ill. Dec. 168, 863 N.E.2d 800.
Since none of the facts with respect to the unjust enrichment claim were in dispute and the parties submitted a joint stipulated record, the claim was properly decided on cross-motions for summary judgment.
The Illinois Supreme Court has held "[t]o state a cause of action based on a theory of unjust enrichment, a plaintiff must allege that the defendant has unjustly retained a benefit to the plaintiff's detriment, and that defendant's retention of the benefit violates the fundamental principles of justice, equity, and good conscience." HPI Health Care Services, Inc. v. Mt. Vernon Hospital, Inc., 131 Ill.2d 145, 160, 137 Ill.Dec. 19, 545 N.E.2d 672 (1989) (quoted in Lakeshore Decaro v. M. Felix, Inc., 371 Ill.App.3d 1103, 1110, 309 Ill.Dec. 649, 864 N.E.2d 890 (2007), Fortech, L.L.C. v. R.W. Dunteman Co., 366 Ill.App.3d 804, 818, 304 Ill.Dec. 201, 852 N.E.2d 451 (2006), and Adams v. American International Group, Inc., 339 Ill.App.3d 669, 675, 274 Ill.Dec. 230, 791 N.E.2d 26 (2003)). A "`cause of action based upon unjust enrichment does not require fault or illegality on the part of [the] defendants; the essence of the cause of action is that one party is enriched and it would be unjust for the party to retain the enrichment.'" Fortech, 366 Ill.App.3d at 818, 304 Ill.Dec. 201, 852 N.E.2d 451, quoting Stathis v. Geldermann, Inc., 295 Ill.App.3d 844, 864, 229 Ill.Dec. 809, 692 N.E.2d 798 (1998).
Defendant's retention of the judicial sale money is not unjust. Defendant lent money and its loan was not paid, and so it foreclosed simply to receive back the money it was owed. When the trial court granted defendant's summary judgment motion, it stated: "Nobody says NationsCredit didn't shell out money in return for getting the mortgage. As a result of the judicial sale, it got its mortgage paid * * *." Getting a mortgage paid is not unjust.
This is not a case of unjust enrichment but a case of mistake. Both parties relied on wrong PIN and lot numbers. Both parties, which are in the real estate business, failed to conduct an adequate title search that would have revealed their error. As the trial court stated, "[i]f Eighteen Investments chose, in effect, to make the same mistake NationsCredit did, then it is difficult to see why NationsCredit as opposed to Eighteen Investments should suffer or why the Court should exercise its equitable power to move the loss from Eighteen Investments to NationsCredit."
Plaintiff claims the circuit court should exercise its equitable power to move the loss from defendant to plaintiff because defendant has title insurance and plaintiff does not. In essence, plaintiff asks the circuit court to give plaintiff the benefit of defendant's title insurance and leave the title insurance company holding the bag. However, plaintiff has not cited a single case to support the proposition that a circuit court should wield its equitable power against an entity whom plaintiff voluntarily dismissed as a party.

CONCLUSION
For the foregoing reasons, the judgement of the trial court is affirmed.
Affirmed.
McBRIDE, P.J., and GARCIA, J., concur.
NOTES
[1]  In support of its claim in its appellate brief that the foreclosure court found the release to be a forgery, the defendant cited to page 020 in "Volume 5, Supplemental Record." However, there were only two volumes of supplemental record filed.
[2]  During oral argument concerning the motions for summary judgment, plaintiff's counsel stated: "Unfortunately, I did not represent the [sic] plaintiffs Eighteen Investments in that property proceeding. Unfortunately, that argument, your Honor, as far as the pin and the legal description was not raised. * * * And there's our quandary, your Honor. It was an issue that wasn't raised that should have been raised."
