Randy L. Brandt v. Wayne E. Lee

This opinion will be unpublished and may not be cited except as provided by Minn. Stat. § 480A.08, subd. 3 (2014). STATE OF MINNESOTA IN COURT OF APPEALS A14-0446 Randy L. Brandt, et al., Appellants, vs. Wayne E. Lee, et al., Respondents. Filed February 9, 2015 Affirmed in part, reversed in part, and remanded Hooten, Judge Douglas County District Court File No. 21-CV-11-108 Jeramie Richard Steinert, Steinert, P.A., Minneapolis, Minnesota (for appellants) Michael J. Dolan, Thornton, Reif, Dolan, Bowen & Klecker, P.A., Alexandria, Minnesota (for respondents) Considered and decided by Hooten, Presiding Judge; Rodenberg, Judge; and Kirk, Judge. UNPUBLISHED OPINION HOOTEN, Judge In a challenge to two summary-judgment dismissals of their numerous claims, appellants argue that the district court erred by: (1) dismissing some of their claims on a res judicata defense that respondents neither pleaded nor properly noticed; (2) dismissing two of their claims on a res judicata defense that was not supported by the record; and (3) dismissing their other claims on the merits. Except for the district court’s grant of summary judgment on appellants’ unjust-enrichment claim, which we affirm, we reverse the dismissal of all of appellants’ other claims and remand for further proceedings consistent with this decision. FACTS Appellants Randy L. Brandt, Donna M. Brandt, and R & P Gourmet Food Processing, Inc. (R & P), contest the district court’s grant of summary judgment and dismissal of their numerous claims against respondents Wayne E. Lee and Gloria O. Lee. In 2005, the Brandts incorporated and were the sole corporate shareholders of R & P, a gourmet beef-processing business. The Brandts and R & P then purchased the equipment, building, and outstanding accounts of another beef-processing business. The Brandts, who needed additional capital for the business, were unable to secure a bank loan and eventually approached mortgage brokers John Zell and Dale Jones for financing. Zell and Jones agreed to lend money to the Brandts and R & P if they provided sufficient collateral for the loan. At that time, the Brandts personally owned additional property unrelated to their beef-processing venture, including their residence, a 5.01-acre parcel adjacent to their residence, and tillable land. The Brandts and R & P also owned farm equipment and cattle. The Brandts and R & P agreed to provide Zell and Jones with a mortgage on the Brandts’ residence, the R & P beef-processing plant and equipment, and the tillable land in exchange for loans totaling $807,000. However, the Brandts and R & P did not mortgage the 5.01-acre parcel, farm equipment, or cattle as part of the agreement with Zell and Jones. 2 The Brandts and R & P struggled to keep up with their payments on the loan from Zell and Jones. Beginning in August 2006, the Brandts and R & P began borrowing money from the Lees in order to stave off arrearages on the Zell and Jones loan. Later in 2006, in conjunction with a series of loans totaling $155,000, the Brandts and R & P executed a promissory note and a security agreement in which they granted a security interest to the Lees as mortgagees in the 5.01-acre parcel, farm equipment, and cattle. Once again, the Brandts were unable to keep up with their payments on the Zell and Jones loan. As a result, Zell and Jones served a foreclosure notice on their mortgage with the Brandts and R & P. Unable to get additional funds from the Lees, in May 2007, the Brandts and R & P entered into an option contract with a third party, Skipper Cook, in order to raise the funds to prevent Zell and Jones from continuing with their foreclosure proceedings. According to the terms of the option contract, Cook paid the Brandts and R & P $25,000 and, in exchange, the Brandts and R & P gave Cook an option to purchase the Brandts’ residence, the 5.01-acre parcel, the tillable land, and the R & P beef- processing plant and equipment at a below-market-rate price. The Brandts and R & P retained a right to void the option by paying Cook $32,500 before Cook exercised his option to buy. After receiving the $25,000, the Brandts and R & P were able to reinstate the mortgage with Zell and Jones. Within the option period, Cook sent the Brandts a letter stating, “Per [s]ection 3 (“Notice to Exercise”) of the option agreement between you and I, please take this as formal notification of my intent to exercise the option.” The Brandts then turned to the 3 Lees for help in buying out Cook’s option in order to prevent him from purchasing their property at the reduced rate. In response, in July 2007, the Lees entered into an amended promissory note and a security agreement (collectively, the amended agreement) with the Brandts and R & P in which Mr. Lee agreed to pay Cook $45,000 in exchange for the assignment of the option to Mr. Lee. As part of the amended agreement, the Brandts conveyed their 5.01-acre parcel to the Lees by quitclaim deed in lieu of the Lees’ commencement of foreclosure proceedings on their mortgage. The Brandts and R & P also provided the Lees with a second mortgage on the Brandts’ residence, the R & P beef-processing plant and equipment, and the tillable land, which was junior to the first mortgage held by Zell and Jones. The Brandts signed an amended promissory note for the balance of the amounts due and owing to the Lees, which replaced their prior promissory note with the Lees and gave the Lees an advance of $10,850. The Brandts and R & P agreed that they would pay the new promissory note by September 1, 2007, and that, if they failed to do so, they would sell the residence and tillable land, as well as the R & P beef-processing plant, in order to satisfy “all liens, encumbrances, judgments, and all expenses related to the sale of the property.” As part of the amended agreement, the Brandts and R & P also agreed to pay Mr. Lee a $40,000 fee in exchange for consulting services from Mr. Lee to help them “preserv[e] their business and property interests” (the consulting contract). The Brandts and R & P did not pay the Lees the amounts due by September 1, 2007, and they also defaulted on the Zell and Jones loan. In December 2007, Zell and Jones foreclosed on the Brandts’ residence, the R & P beef-processing plant and 4 equipment, and the tillable land. The sale of the property to a private party generated $169,000 more than the balance due and owing on the Zell and Jones note. The Brandts received the surplus generated by the sale and were advised by the Lees that the $169,000 should be used to improve the beef-processing plant, which was in its redemption period. After the redemption period, the Lees purchased the residence, the R & P plant and equipment, and the tillable land from the private party at the foreclosure-sale price. In 2008, the Lees instituted an action to recover the balance of the surplus from the foreclosure sale claimed by the Brandts and R & P, and to foreclose on their mortgage with the Brandts and R & P. During the course of the 2008 action,1 the parties entered into stipulated agreements whereby the Brandts and R & P agreed to pay to the Lees the surplus and proceeds from the foreclosure sale. In order to satisfy the Brandts and R & P’s obligations under the amended agreement, the Lees were allowed to sell the cattle, farm equipment, and some of the Brandts’ personal property. This brings us to the current action. The Brandts and R & P brought a complaint against the Lees in May 2011, alleging breach of contract, unjust enrichment, replevin, wrongful sale, conversion, fraudulent and negligent misrepresentation, violations by Mr. Lee of his obligations as a foreclosure consultant under Minn. Stat. §§ 325N.01–.09 (2014) and as a foreclosure purchaser under Minn. Stat. §§ 325N.10–.18 (2014), and violations of the Minnesota 1 The Lees and the district court refer to this as a “replevin action,” but the Brandts and R & P dispute that characterization. The word “replevin” does not appear on any of the documents submitted to the district court in connection with the 2008 action. 5 Consumer Fraud Act under Minn. Stat. § 325F.69 (2014). In their answer, the Lees allege that the complaint failed to state a claim upon which relief could be granted. The answer also provided the following: [The Lees] affirmatively allege that the claims may be barred by any and all of the affirmative defenses set forth and/or contemplated by Rule 8.03 of the Minnesota Rules of Civil Procedure. The extent to which [the Brandts and R & P’s] claims may be barred by one or more of said affirmative defenses, not specifically set out above, cannot be determined until there has been further discovery. Therefore all such affirmative defenses set forth in and/or contemplated by Rule 8.03 are incorporated in this [a]nswer. The answer was never amended to specifically plead any affirmative defenses. The Lees moved for summary judgment, attaching four court orders from the 2008 action. But, the Lees did not attach the pleadings or a final judgment from that action. The Lees did not make any res judicata arguments in their summary-judgment submission to the district court. At the hearing on the motion for summary judgment, the Lees argued for the first time that the replevin, wrongful sale, and conversion claims were precluded under res judicata principles as a result of the parties’ stipulated agreements in the 2008 action. The Brandts and R & P objected to res judicata being raised as a “new affirmative defense[]” at the hearing and to the district court’s consideration of the issue without proper notice. Alternatively, the Brandts and R & P argued that, even if the district court was to consider the res judicata effect of the 2008 action, the documents provided to the district court were insufficient as a matter of law to support the Lees’ res judicata defense. 6 In a 2013 order, the district court granted summary judgment for the Lees on every claim except for the two counts brought by the Brandts and R & P under the foreclosure- consultant statute and the Consumer Fraud Act. The district court: (1) dismissed the replevin, wrongful sale, conversion, and two of the breach-of-contract claims as barred by res judicata; (2) granted summary judgment on the merits for two breach-of-contract claims and the unjust-enrichment claim; (3) granted summary judgment on the fraudulent- and negligent-misrepresentation claims and the claim brought under the foreclosure-purchaser statute; (4) denied summary judgment on the claim brought under the foreclosure-consultant statute, determining that there were genuine issues of material fact as to whether Mr. Lee violated the statute; and (5) denied summary judgment on the claim brought under the Consumer Fraud Act on the basis that a violation of the foreclosure-consultant statute “would automatically trigger a violation” of the act. After the summary-judgment order was issued, the Lees filed a motion in limine, arguing that the remaining two counts in the case should be barred as a result of res judicata. The Lees argued that the issue of whether Mr. Lee was a foreclosure consultant should have been raised in the 2008 action and that, under principles of res judicata, it was barred from being asserted in this action. The Brandts and R & P again argued that, because the Lees did not properly plead res judicata as an affirmative defense and did not satisfy the requirements for proving res judicata, the Lees’ motion in limine should be denied. A hearing was held on the Lees’ motion in limine, and in a 2014 order, the district court sua sponte granted summary judgment for the Lees on the final two counts, 7 concluding that the statutory foreclosure-consultant claim was barred by res judicata and the Consumer Fraud Act claim was dependent on the existence of a viable foreclosure- consultant claim.2 In basing its ruling on principles of res judicata, the district court determined that the foreclosure-consultant claim could have been resolved during the 2008 action. The Brandts and R & P appealed to this court the dismissal of their replevin, wrongful sale, conversion, breach-of-contract, and unjust-enrichment claims, as well as their claims brought under the foreclosure-consultant statute and the Minnesota Consumer Fraud Act. The Brandts and R & P did not appeal the grant of summary judgment on their fraudulent- and negligent-misrepresentation claims and their claims brought under the foreclosure-purchaser statute. DECISION I. The Brandts and R & P argue that the district court’s grant of summary judgment in its 2013 order on their replevin, wrongful sale, conversion, and two of their breach-of- contract claims3 was improperly based on an unpleaded, insufficiently noticed, and unbriefed affirmative defense of res judicata. In response, the Lees argue that they 2 The district court also determined that the foreclosure-consultant claim was a cause of action against Mr. Lee individually because, on that count, the Brandts and R & P made “specific factual allegations against Mr. Lee only.” 3 The two breach-of-contract claims dismissed in the 2013 order arise from: (1) the Lees’ alleged failure to properly apply payment proceeds from the sale of the 5.01-acre parcel in accordance with the amended agreement; and (2) the Lees’ alleged sale of equipment at a private sale without notice, and sale of the cattle without notice, when the terms of the amended agreement required both notice and a public sale. 8 properly pleaded res judicata by pleading all affirmative defenses generally in their answer. Res judicata is an affirmative defense, which must be pleaded. Minn. R. Civ. P. 8.03. “An affirmative defense must be pleaded specifically and the failure to do so results in a waiver of the defense.” Rhee v. Golden Home Builders, Inc., 617 N.W.2d 618, 621 (Minn. App. 2000) (emphasis added). There are two main purposes in requiring affirmative defenses to be pleaded specifically: (1) to give the opposing party notice of the affirmative defense; and (2) to give the opposing party an opportunity to rebut the affirmative defense. Blonder-Tongue Labs., Inc. v. Univ. of Ill. Found., 402 U.S. 313, 350, 91 S. Ct. 1434, 1453 (1971); Snyder v. City of Minneapolis, 441 N.W.2d 781, 788 (Minn. 1989) (noting that the purpose of requiring pleading of affirmative defenses is to give the opposing party notice and an opportunity to argue why the claim should not be barred completely). Whether the district court erred in allowing a party to raise an affirmative defense for the first time at the summary-judgment hearing is reviewed for an abuse of discretion. Cf. Rhee, 617 N.W.2d at 621 (involving the district court’s decision to allow a party to amend the pleadings). The Lees’ pleadings do not allege the affirmative defense of res judicata, but only generally assert that all affirmative defenses are incorporated into the answer. The Lees’ failure to specifically plead res judicata as an affirmative defense is further exacerbated by their failure to mention the assertion of the affirmative defense in their summary- judgment motion and their submissions in conjunction with that motion. Based upon this record, we conclude that the Lees did not specifically raise the res judicata defense until 9 the summary-judgment hearing, thereby depriving the Brandts of any meaningful opportunity to prepare a response. While the Brandts later had an opportunity to oppose res judicata in response to the Lees’ motion in limine, many of their claims had already been dismissed by the district court as barred by res judicata. In granting the Lees’ summary-judgment motion under these circumstances, the district court erred by ignoring rule 8.03’s requirement that affirmative defenses must be specifically pleaded. By allowing the Lees to successfully assert an affirmative defense that they had not pleaded, the district court rewarded the Lees’ ambush at the summary- judgment hearing. Raising an affirmative defense for the first time at a hearing with no prior notice given to the opposing party is precisely the kind of ambush tactic that the pleading rules are designed to prevent. “[A] party . . . is bound by the pleadings unless the other issues are litigated by consent. Clearly relief cannot be based on issues that are neither pleaded nor voluntarily litigated.” Roberge v. Cambridge Coop. Creamery Co., 243 Minn. 230, 233–34, 67 N.W.2d 400, 403 (1954) (emphasis added); see also Hauschildt v. Beckingham, 686 N.W.2d 829, 837 (Minn. 2004) (“[T]he focus [when applying the doctrine of res judicata] is on whether [its] application would work an injustice on the party against whom the doctrine[ is] urged.”). Because the district court improperly considered res judicata without the affirmative defense having been pleaded, noticed, or briefed prior to the summary- judgment hearing, we do not need to address the merits of the res judicata defense as to the Brandts’ and R & P’s replevin, wrongful sale, conversion, and two of their breach-of- contract claims. The Brandts and R & P argue that, “[w]ith notice and a meaningful 10 opportunity to oppose, [they] would be entitled to show the [res judicata] defense lacks factual merit.” They claim that they “deserve a chance” to address the res judicata defense, “especially considering that they have evidence to place a crushing end to the affirmative defense.” Because the district court abused its discretion in granting summary judgment based on an unpleaded, insufficiently noticed affirmative defense, we reverse and remand for further proceedings consistent with this opinion. In light of our disposition of this matter, we do not need to consider the request of the Brandts and R & P that we take judicial notice of an order dismissing the 2008 action without prejudice. II. In their complaint, the Brandts and R & P allege that Skipper Cook exercised the option, which obliged Cook to purchase the Brandts’ residence, the 5.01-acre parcel, the tillable land, and the R & P beef-processing plant and equipment for $817,000. The Brandts and R & P also allege that Cook assigned the option to Mr. Lee and that Mr. Lee breached the terms of the option contract and the amended agreement by failing to purchase the property. In granting summary judgment for the Lees on this breach-of- contract claim, the district court explained: “[I]t is clear that Mr. Lee did not purchase Mr. Cook’s option. Rather he tendered $45,000 to Mr. Cook for the benefit of the [Brandts and R & P] in order to extinguish Mr. Cook’s [o]ption.” The district court concluded that Mr. Lee “had no obligation to purchase [the Brandts’ and R & P’s] property pursuant to the [o]ption.” 11 “We review a district court’s summary judgment decision de novo. In doing so, we determine whether the district court properly applied the law and whether there are genuine issues of material fact that preclude summary judgment.” Riverview Muir Doran, LLC v. JADT Dev. Grp., LLC, 790 N.W.2d 167, 170 (Minn. 2010) (citation omitted). “Absent ambiguity, the interpretation of a contract is a question of law.” Roemhildt v. Kristall Dev., Inc., 798 N.W.2d 371, 373 (Minn. App. 2011), review denied (Minn. July 19, 2011). “The plain and ordinary meaning of the contract language controls, unless the language is ambiguous.” Bus. Bank v. Hanson, 769 N.W.2d 285, 288 (Minn. 2009). “A breach of contract is a failure, without legal excuse, to perform any promise that forms the whole or part of the contract.” Lyon Fin. Servs., Inc. v. Ill. Paper & Copier Co., 848 N.W.2d 539, 543 (Minn. 2014). “The elements of a breach of contract claim are (1) formation of a contract, (2) performance by plaintiff of any conditions precedent to his right to demand performance by the defendant, and (3) breach of the contract by defendant.” Id. (quotation omitted). In order to determine whether Mr. Lee breached the terms of the option contract, it must first be determined whether Cook exercised the option before he and Mr. Lee entered into a transaction regarding the option contract. “The election to exercise [an] option must be clear, unambiguous, and according to and in the manner prescribed by the terms of the option agreement.” Brachmann v. Netzinger, 293 Minn. 405, 407, 196 N.W.2d 616, 618 (1972). “The general rule is that where an option has been exercised it becomes a contract for the sale of the property on the part of the [optionor] and a binding 12 agreement upon the [optionee] to pay the option price.” Gassert v. Anderson, 201 Minn. 515, 518, 276 N.W. 808, 809 (1937). Under the option contract, Cook could exercise his option from May 31, 2007, until August 31, 2007. Under the heading, “Notice of Exercise,” the contract states: “This option is to be exercised by [Cook] by sending one or more written notices to [the Brandts and R &P] by personal delivery or U.S. [r]egistered mail . . . .” Under the heading, “Exercise of Option,” the contract states, “Upon exercise of this option and payment of the [p]urchase [p]rice, [the Brandts and R & P] shall convey to [Cook] marketable fee title to the [p]roperty . . . .” The contract also gave the Brandts and R & P the right to void the option by paying Cook $32,500 “prior to the exercise of the [o]ption by [Cook].” On June 4, 2007, Cook sent a written notice to the Brandts and R & P, stating, “Per [s]ection 3 [“Notice of Exercise”] of the option agreement between you and I, please take this as formal notification of my intent to exercise the option.” (Emphasis added.) Then, on July 19, 2007, Cook and Mr. Lee entered into an agreement entitled, “Assignment of Option Agreement.” This agreement states that “the interest of Skipper S. Cook in the [option contract] . . . is hereby assigned and transferred to Wayne E. Lee.” In addition, the amended agreement states that Mr. Lee “agrees to pay Skipper Cook [$45,000] for an assignment of the [o]ption” and “agrees to forebear from close on exercise [sic] of the [o]ption until September 1, 2007.” According to the plain language of the agreement entered into by Cook and Mr. Lee and of the amended agreement, Cook assigned his interest in the option contract to 13 Mr. Lee. The district court erred by determining that the option was extinguished when Mr. Lee purchased it from Cook. However, contract ambiguities and genuine issues of material fact prevent us, as a reviewing court, from making further determinations with regard to the option contract. First, the option contract is ambiguous as to how Cook could exercise the option. Was mere notice enough, or was Cook required to give notice and tender the purchase price? It is also unclear what the effect of giving “notice” is. The meaning of these ambiguous contract provisions must be determined before the district court in the first instance. Second, there is a genuine issue of material fact as to whether Cook validly exercised his option by sending his June 4 letter to the Brandts and R & P. In the letter, Cook gave notice of his “intent to exercise the option,” but it is unclear whether he actually exercised the option and whether he did so “in the manner prescribed by the terms of the option agreement.” See Brachmann, 293 Minn. at 407, 196 N.W.2d at 618. Third, while it is clear that Cook assigned his option to Mr. Lee, the provision of the amended agreement that states that Mr. Lee “agrees to forebear from close on exercise [sic] of the [o]ption” is ambiguous, and its meaning must also be determined before the district court. If Cook exercised the option, then a bilateral contract was formed between Cook and the Brandts and R & P for the purchase of the Brandts’ and R & P’s property. See Gassert, 201 Minn. at 518, 276 N.W. at 809. If so, then Mr. Lee purchased an exercised option and was assigned all of Cook’s rights and obligations, and he was therefore obligated to purchase the property, as the Brandts and R & P now argue. On the other hand, if Cook did not exercise the option, then Mr. Lee purchased an unexercised option, 14 and the Brandts and R & P are not entitled to any relief on this claim because it is axiomatic that the holder of an unexercised option is not obligated to exercise it. Because of these contract ambiguities and genuine issues of material fact that have not been resolved, we reverse the district court’s grant of summary judgment on this breach-of-contract claim and remand for further proceedings consistent with this opinion. III. We next analyze the Brandts’ and R & P’s claims arising out of the consulting contract between them and Mr. Lee as part of the amended agreement. We analyze the statutory claims first and the common-law breach-of-contract claim second. A. The Brandts and R & P challenge the district court’s dismissal in its second summary-judgment order of their claims under the foreclosure-consultant statute and the Consumer Fraud Act. In response to a motion in limine brought by the Lees, the district court dismissed the foreclosure-consultant claim on the ground that it was barred by the 2008 action under the principle of res judicata. Holding that their claim under the Consumer Fraud Act was dependent upon the viability of their claim under the foreclosure-consultant statute, the district court also dismissed this ancillary claim. In support of their argument that the district court erred in its dismissal of these claims, the Brandts and R & P raise the same procedural arguments regarding the failure of the Lees to specifically plead res judicata as an affirmative defense in their answer. In addition, they argue that the district court abused its discretion by sua sponte treating the Lees’ motion in limine as a summary-judgment motion. 15 But, the circumstances surrounding the district court’s consideration of the Lees’ res judicata defense in conjunction with their motion in limine are significantly different than those that previously existed at the time the district court heard the Lees’ summary- judgment motion. In their motion in limine, the Lees raised their res judicata defense at the time they filed their motion in limine more than 28 days before the hearing. See Minn. R. Gen. Pract. 115.03. On the other hand, in their prior summary-judgment motion, the Lees did not raise the issue of res judicata until the summary-judgment hearing itself. Also, more than six months before the motion in limine hearing, the district court had already issued its order dismissing most of the Brandts’ and R & P’s other claims on res judicata grounds. As a result, the Brandts and R & P had ample notice that the Lees were claiming that the foreclosure-consultant claim was barred under res judicata and were provided with ample time to fully consider and brief the res judicata issue. Whether prejudice results from the district court’s consideration of an unpleaded affirmative defense “is a question of fundamental fairness,” and “[p]rejudice may be demonstrated by lack of notice, procedural irregularities, or lack of a meaningful opportunity to respond to the motion.” Bradley v. First Nat’l Bank of Walker, 711 N.W.2d 121, 128 (Minn. App. 2006). Based upon this record, the procedural posture here is distinguishable from that in Rhee, 617 N.W.2d at 621, where we reversed summary judgment based upon an unpleaded and unnoticed res judicata defense, and more similar to that in Zirnhelt v. Carter, where we upheld a district court’s consideration of an unpleaded statute-of-limitations defense even though the defense was not raised 16 until trial. 843 N.W.2d 270, 273 (Minn. App. 2014). In Zirnhelt, we emphasized that “the district court gave both sides a full opportunity to brief the statute-of-limitations issue,” and therefore “Zirnhelt was not prejudiced by the district court’s consideration of the issue.” Id. at 273. Because the Brandts and R & P had adequate notice that the Lees were asserting a res judicata defense prior to the motion in limine hearing and had an opportunity to fully respond to the defense, the district court did not abuse its discretion in considering the unpleaded defense in conjunction with the motion in limine. There is also no merit to the procedural argument of the Brandts and R & P that the district court abused its discretion by treating the Lees’ motion in limine as a summary-judgment motion and then, sua sponte, granting summary judgment on their remaining statutory claims. The Lees argued in their motion in limine that “any issues regarding [the claim] that [Mr. Lee] is a mortgage foreclosure consultant are barred in this action as a result of res judicata.” Because the granting of the motion in limine would result in the barring and dismissal of the remaining statutory claims, the motion in limine was, in effect, a summary-judgment motion. See Hebrink v. Farm Bureau Life Ins. Co., 664 N.W.2d 414, 418–19 (Minn. App. 2003) (holding that a motion in limine may be treated as a motion for summary judgment if it results in the dismissal or barring of a claim). “The district court has the authority to grant summary judgment, sua sponte, when (a) no genuine issues of material fact remain, (b) one of the parties deserves judgment as a matter of law, and (c) the absence of a formal motion creates no prejudice to the party against whom summary judgment is granted.” Id. at 419. The district court 17 did not abuse its discretion in treating the motion in limine as a summary-judgment motion and in considering the Lees’ assertion of their res judicata defense. Concluding that there were no procedural impediments to the district court’s consideration of the Lees’ res judicata defense in their motion in limine, we next consider the merits of the district court’s grant of summary judgment on the foreclosure-consultant and Consumer Fraud Act claims. “Res judicata precludes parties from raising subsequent claims in a second action when: (1) the earlier claim involved the same set of factual circumstances; (2) the earlier claim involved the same parties . . . ; (3) there was a final judgment on the merits; [and] (4) the estopped party had a full and fair opportunity to litigate the matter.” Brown-Wilbert, Inc. v. Copeland Buhl & Co., 732 N.W.2d 209, 220 (Minn. 2007) (quotation omitted). The burden is on the party moving for res judicata to prove each and every element of this affirmative defense. See MacRae v. Grp. Health Plan, Inc., 753 N.W.2d 711, 716 (Minn. 2008).4 The Brandts and R & P argue that the district court erred in concluding that the foreclosure-consultant claim was barred as a result of the 2008 action. In support of their res judicata defense, the Lees presented the district court with four stipulated orders from 4 The Minnesota Supreme Court has held that [r]es judicata and collateral estoppel are related doctrines. Fundamental to both doctrines is that a right, question or fact distinctly put in issue and directly determined by a court of competent jurisdiction . . . cannot be disputed in a subsequent suit between the same parties or their privies . . . . Although the terms are sometimes used interchangeably, each doctrine is distinct in its effect. Hauschildt, 686 N.W.2d at 837 (quotations and citations omitted). 18 the 2008 action. In the first order, the district court, with the agreement of the parties, provided that the Lees were authorized to advertise and sell property which was “expressly allowed and agreed upon by the parties” in the complaint. This consisted of a vehicle, all cattle and farm equipment in which the Lees had a security interest, and any property purchased with funds received by the Brandts and R & P as a result of the foreclosure sale. In the second order, the district court, with the consent of the parties, corrected a clerical error with regard to identifying the vehicle referenced in the first order. In the third order, the district court, with the agreement of the parties, provided that the Brandts and R & P were to pay the Lees’ attorney fees and costs by forwarding their rental proceeds from a property that was part of the litigation directly to the trust fund of the Lees’ attorney. The fourth stipulated order provides for a release of these trust funds to the Lees’ attorney for attorney fees and costs, with any balance going to the Lees. The Lees did not produce the pleadings from the 2008 action. Nor did they produce an order and judgment dismissing the action, or a final entry into judgment from any of the stipulated orders. Based upon this scant record, the district court concluded that the 2008 action barred the foreclosure-consultant claim, determining that the stipulated orders constituted final judgments for purposes of res judicata and that the Brandts and R & P failed to produce a copy of a purported order dismissing the 2008 action without prejudice. The district court erred as a matter of law by failing to place the burden of proof upon the Lees, as the moving party, to prove each and every element of this affirmative defense. See id. The Lees had the burden to prove that there was a final judgment in the 2008 19 action, not the Brandts and R & P. Furthermore, there is nothing in this record that supports the district court’s holding that the 2008 action specifically barred the foreclosure-consultant claim. There is no mention in the stipulated orders of a “foreclosure consultant” claim, or any other claim for that matter, but only a discussion regarding the disposition of personal property, most of which are not even specifically identified.5 There are no reasons set forth in the stipulated orders as to why the Lees were authorized to sell the property. Nor is there any language anywhere in the four stipulated orders which identify the claims made by the Lees in the 2008 action. Significantly, there is nothing in the stipulated orders that indicates that any claims were dismissed as a result of this disposition of property. All these stipulated orders show is that the same parties were involved in the 2008 action. We are not able to discern from these stipulated orders that the action involved the same set of factual circumstances, that there was a final judgment on the merits with regard to the foreclosure-consultant claim, or that the Brandts and R & P had a full and fair opportunity to litigate the foreclosure-consultant claim or any other claim in the 2008 action. Because of the insufficiency of the record, as well as the district court’s error in shifting the burden of proof of an affirmative defense to the non-moving party, we 5 Although the first stipulated order in the 2008 action referred to exhibits B and I to the complaint, neither the complaint nor the attached documents were submitted to the district court in the current action or are included in the record on appeal. See Minn. R. Civ. App. P. 110.01 (“The documents filed in the trial court, the exhibits, and the transcript of the proceedings, if any, shall constitute the record on appeal in all cases.”). 20 reverse the district court’s grant of summary judgment on the foreclosure-consultant claim and the Consumer Fraud Act claim. B. The consulting contract, signed in July 2007 as part of the amended agreement, states in part: The Brandts and R & P agree that [Mr.] Lee should be paid a [$40,000] consultant fee. The consultant fee is being paid for [Mr.] Lee’s time, efforts, and advice given to the Brandts and R & P to assist them in preserving their business and property interests. This consulting arrangement shall continue through August 31, 2007. In its first summary-judgment order, the district court concluded that, under the consulting contract, the Brandts’ and R & P’s payment of $40,000 to Mr. Lee was a condition precedent to Mr. Lee’s duty to perform. In granting summary judgment for the Lees on the merits of this claim, the district court reasoned that, because Mr. Lee did not receive payment for any services, he could not have committed a breach by failing to provide such services. The district court, in discussing the consulting contract with reference to the Brandts and R & P’s claim under the foreclosure-consultant statute, found that Mr. Lee fell within the statutory definition of “foreclosure consultant” and rejected the Lees’ claim that he met one of the definition’s statutory exceptions. See Minn. Stat. § 325N.01(a), (b). According to the plain language of the consulting contract, Mr. Lee, in exchange for compensation, agreed to provide advice to the Brandts “to assist them in preserving their business and property interests.” Because the Brandts were attempting to 21 avoid foreclosure or loss of their property, they arguably contracted for advice from Mr. Lee that would “in any manner . . . stop or postpone the foreclosure sale[;] . . . obtain any forbearance from [a] . . . mortgagee”; or stop, postpone, or minimize the financial impact of a foreclosure sale upon the Brandts and R & P. See id., subd. (a). But, if the foreclosure-consultant statute applies to the consulting contract, then Mr. Lee could not successfully claim that payment was a precondition to his providing services. Rather, it is a violation of the foreclosure-consultant statute for a foreclosure consultant to “claim, demand, charge, collect, or receive any compensation until after the foreclosure consultant has fully performed each and every service the foreclosure consultant contracted to perform or represented he or she would perform.” Minn. Stat. § 325N.04(1) (2014) (emphasis added). The Brandts and R & P brought both a common-law claim and a claim under the foreclosure-consultant statute relative to the consulting contract. In their complaint, the Brandts and R & P allege that, in conjunction with the amended agreement, Mr. Lee represented that he would keep their property “from going to Zell/Jones and Mr. Cook” and that the Brandts and R & P “would not lose their equity or property interests.” They further allege that Mr. Lee breached the consulting contract by failing “to take any measures to preserve [the Brandts’ and R & P’s] real and personal property.” The district court, in its order granting the Lees’ motion in limine on the statutory foreclosure- consultant claim, noted that Mr. Lee admitted that he never performed the “consulting services,” but erroneously dismissed the foreclosure-consultant claim on res judicata grounds, as discussed in the previous section. Mr. Lee’s admission at least created a 22 genuine issue of material fact as to whether he breached the consulting contract by failing to provide consulting services to the Brandts and R & P that would allow them to preserve their business and property. If the consulting contract is covered by the foreclosure-consultant statute, Mr. Lee would have been required by law to provide consulting services to the Brandts prior to receiving or demanding payment. However, in its second summary-judgment order, the district court found that, in the 2008 action, “the Lees sought payment of the $40,000 consulting fee.” Based upon this record, there is also a genuine issue of material fact as to whether Mr. Lee breached the consulting contract by demanding payment prior to performing services. Because resolution of the statutory foreclosure-consultant claim affects the interpretation and enforcement of the consulting contract, there is a genuine issue of material fact as to the Brandts’ and R & P’s breach-of-contract claim and their claim under the foreclosure-consultant statute. For that reason, we reverse summary judgment on both claims. IV. The Brandts and R & P contend that the district court erred in granting summary judgment to the Lees on their unjust-enrichment claim. “In order to establish a claim for unjust enrichment, the claimant must show that another party knowingly received something of value to which he was not entitled, and that the circumstances are such that it would be unjust for that person to retain the benefit.” Schumacher v. Schumacher, 627 N.W.2d 725, 729 (Minn. App. 2001). “[I]t must be shown that a party was unjustly enriched in the sense that the term ‘unjustly’ could mean illegally or unlawfully.” Id. (quotation omitted). A party cannot recover for unjust enrichment, however, if it has an 23 adequate remedy at law. ServiceMaster of St. Cloud v. GAB Bus. Servs., Inc., 544 N.W.2d 302, 305 (Minn. 1996). Moreover, “equitable relief cannot be granted where the rights of the parties are governed by a valid contract.” U.S. Fire Ins. Co. v. Minn. State Zoological Bd., 307 N.W.2d 490, 497 (Minn. 1981). The Brandts and R & P point to three separate instances in which the Lees were unjustly enriched, alleging that the Lees: (1) wrongfully took farm equipment and cattle under their original mortgage with the Brandts and R & P, even though that mortgage was satisfied by the amended agreement; (2) received the unjust benefit of the surplus proceeds from the foreclosure sale by requiring the Brandts and R & P to use the proceeds as directed by the Lees and, later, claiming the proceeds; and (3) were unjustly enriched by Mr. Lee’s failure to adhere to the terms of the option contract. We conclude that these claims are without merit. As to the first allegation, the Brandts and R & P argue that the Lees’ original mortgage in the 5.01-acre parcel, farm equipment, and cattle was “satisfied” when the parties entered the amendment agreement. But, this argument is belied by the record. As part of the amended agreement, the Brandts conveyed the 5.01-acre parcel to the Lees “in lieu of [the Lees’] commencing a foreclosure.” The Brandts and R & P also gave the Lees a second mortgage in the Brandts’ residence, the R & P beef-processing plant and equipment, and the tillable land “to secure payment of” the option buy-out, the consultant fee, “and any amount owing on the [original promissory note] less the value” of the sale of the 5.01-acre parcel. The Brandts’ and R & P’s argument that the original note was “satisfied and a nullity” goes against the plain language of the amended agreement. 24 The second and third allegations can be quickly disposed of. As junior creditors, the Lees were entitled to any proceeds from the foreclosure of the Zell and Jones mortgage. These proceeds were instead paid to the Brandts, but the Brandts were never entitled to the funds, and therefore the Lees were not unjustly enriched by directing the Brandts how to use these funds and later claiming them. See Schumacher, 627 N.W.2d at 729. Finally, any claim arising from the failure of Mr. Lee to adhere to the terms of the option contract is governed by contract law and is therefore not subject to equitable remedies. See U.S. Fire Ins. Co., 307 N.W.2d at 497. The district court correctly granted summary judgment on the Brandts’ and R & P’s unjust-enrichment claim. In summary, because the Lees’ affirmative defense of res judicata was not pleaded, noticed, or briefed prior to the hearing of the Lees’ summary-judgment motion, we reverse the grant of summary judgment on the replevin, wrongful-sale, and conversion claims, as well as the breach-of-contract claims relating to the Lees’ failure to properly apply payment proceeds from the sale of the 5.01-acre parcel and failure to sell property publicly and with proper notice. We remand these claims for further proceedings consistent with this opinion. We reverse on the merits the district court’s grant of summary judgment on the consulting-contract and option-contract claims, as well as the foreclosure-consultant and Consumer Fraud Act claims, and remand for further proceedings consistent with this opinion. We affirm the district court’s grant of summary judgment on the unjust-enrichment claim. On remand, the district court may in 25 its discretion grant the Lees leave to amend their answer. See Schober v. Comm’r of Revenue, 853 N.W.2d 102, 112–13 (Minn. 2013). Affirmed in part, reversed in part, and remanded. 26