697 P.2d 1244

#### Dennis A. DURSTELER and Gloria J. Dursteler, husband and wife, Plaintiffs-Respondents, v. Michael P. DURSTELER and Mary T. Dursteler, husband and wife, Defendants-Appellants.

No. 14639.

Court of Appeals of Idaho.

March 29, 1985.

*232R.M. Whittier and Monte R. Whittier (argued), Whittier & Souza, P.A., Pocatello, for defendants-appellants.

Edward J. Berrett, Merrill & Merrill, Chartered, Pocatello, for plaintiffs-respondents,

BURNETT, Judge.

This litigation arises from the abortive sale of an Idaho mink ranch. We are asked to decide whether the trial court erred in ruling that the sale contract was unenforceable and in ordering the would-be sellers to reimburse the buyers for certain expenditures. We affirm the trial court’s judgment in part, modify it in part and remand the case.

The background facts are undisputed. The owners of the mink ranch, Michael and Mary Dursteler, entered into a written contract to sell the property to Michael’s brother Dennis and his wife Gloria. The contract provided for a down payment of $10,000 and periodic payments thereafter. It also provided that the parties would establish an interim partnership to operate the business while the buyers became acquainted with mink ranching. The sellers moved from the ranch to a home they purchased in the nearby city of Preston. The buyers sold their home in Boise and moved to the ranch.

Unfortunately, within a few months the parties found themselves embroiled in controversy. The partnership needed money to finance ranching operations until it received revenue from the sale of pelts. The parties could not agree upon a financing scheme. The buyers ultimately needed an assignment of the sellers’ shares in a feed cooperative which represented the only practical source of food for the mink. The *233parties could not agree upon a price for these shares. The partnership needed to file tax returns in due course, identifying the income and expenses attributable to the partnership and distinguishing them from income and expenses generated by prepartnership activities of the sellers. The parties could not agree on how such an allocation should be made. None of these areas of disagreement had been addressed in the contract.

Despairing of success at mink ranching under these circumstances, the buyers stopped working in the business, moved off the property and sued for breach of contract. The sellers resumed full control of the premises and filed a counterclaim similarly alleging a breach of contract. The case was tried to a district court sitting without a jury. The judge, presumably to the surprise of both sides, ruled that no one had breached a contract because no enforceable contract had been created. He directed the sellers to return the buyers’ down payment and to reimburse the buyers for certain other expenditures. The sellers appealed.

I

We note initially that this case poses a threshold problem of appellate review. The district court decided the case upon a theory different from that presented by the parties. Of course, a court is not bound slavishly to accept the parties’ view of a case. Indeed, with the advent of notice pleading, the parties themselves have been freed from pleading particular issues or theories. In order to get through the courthouse door, they need only to state claims upon which relief can be granted. *See generally*Rule 8, I.R.C.P. However, once inside the courthouse, they may be required to refine their pleadings in response to motions for more definite statements or in response to pretrial orders and motions for summary judgment. *See*Rules 12(e), 16(a) and 56, I.R.C.P.

This process of refining the issues and theories should be administered fairly by the trial judge:

> [T]he parties [must] have notice of the issues before the court and an opportunity to address those issues with evidence and argument____

> Where nothing in the record indicates that an unpleaded issue was litigated at trial, it is error for the trial court to base its decision on the unpleaded issue.

*M.K. Transport v. Grover,*101 Idaho 345, 349, 612 P.2d 1192, 1196 (1980) (citations omitted). Moreover, where the evidence presented at trial is relevant both to pleaded and unpleaded issues, the trial judge should not treat the evidence as manifesting the parties’ consent to a decision based on an unpleaded issue. *Id.*at 349-50, 612 P.2d at 1196-97.

Where, as here, a trial court goes beyond the theories and issues framed by the parties, it places those aggrieved by its decision in a potentially awkward position on appeal. It forces them to address issues not presented below and to address them in the context of a record different from that which they might have created if the issues had been properly framed. It also forces the appellate court to do something it should seldom do—consider issues not presented by the parties below.

These concerns might lead us, in an appropriate case, to vacate the trial court’s judgment. However, in our view, this is not such a case. The record discloses no objection in the district court to the judge’s venture beyond the pleadings. The sellers, appellants here, objected to the court’s findings of fact and conclusions of law, but did so on other grounds. Similarly, on appeal, the sellers have challenged the correctness, not the scope, of the judge’s findings and conclusions. Accordingly, we will not vacate the judgment but will review it as far as the record permits.

II

We first consider the judge’s ruling that the contract was unenforceable. A contract will be enforced if it is “complete, definite and certain in all its material *234terms, or contains provisions which are capable in themselves of being reduced to certainty.” Giacobbi *Square v. PEK Corp.,*105 Idaho 346, 348, 670 P.2d 51, 53 (1983) (emphasis omitted). To meet this standard the contract must embody a distinct understanding of the parties, showing a meeting of the minds as to all necessary terms of the contract. *E.g., C.H. Leavell and Co. v. Grafe & Associates, Inc.,*90 Idaho 502, 414 P.2d 873 (1966). The obligations of the parties must be identified so that the adequacy of performance can be ascertained. *Dale’s Service Co., v. Jones,*96 Idaho 662, 534 P.2d 1102 (1975). If terms necessary to a contract are left for future negotiation, the contract cannot be enforced. *Brothers v. Arave,*67 Idaho 171, 174 P.2d 202 (1946).

Here, as noted above, the evidence is undisputed that the parties failed to reach an understanding as to how the partnership initially would raise money to run the ranch, how the buyers ultimately would get food for the mink, and how the partnership would report its income and expenses. The question is whether the trial judge correctly concluded, as a matter of law, that these items were essential to the contract. We hold that he did. Absent agreement on these items, the parties’ obligations to each other with respect to operation of the ranch could not be fully ascertained. Continuation of the ranch as a going business was a fundamental ingredient of the transaction. Accordingly, we sustain the court’s ruling that the contract was fatally incomplete and therefore unenforceable.

Ill

We now examine the judge’s decision to compel certain payments by the sellers to the purchasers. Having determined the contract to be unenforceable, the judge stated in his memorandum opinion that he “must attempt to place the parties, as nearly as possible, in the same position as they were at the time of the attempted making of the contract.” This proposition, sounding in rescission, causes us some disquietude. Had a contract existed, and had the court found that the contract was rescinded, the court’s duty would have been as the judge stated. *See, e.g., Blinzler v. Andrews,*94 Idaho 215, 485 P.2d 957 (1971); *McEnroe v. Morgan,*106 Idaho 326, 678 P.2d 595 (Ct.App.1984). But here no enforceable contract existed. There was nothing to rescind.

We do not gainsay that authority exists for granting restitution to parties who have unsuccessfully attempted to form a contract. See *generally*D. DOBBS, REMEDIES § 11.3 (1973); 66 AM.JUR.2d *Restitution and Implied Contracts*§ 7 (1973). But our concern is with the proper application of the remedy. We think the proper use of restitution, in a case such as this, is not to restore the parties’ precontract positions but to assure that each party receives reasonable value for the benefits conferred on the other during the period of attempted performance of the contract.

Under the doctrine of unjust enrichment, parties to a contract that fails to materialize may be required to pay restitution for the value of benefits each has conferred and the other has unjustly retained. *E.g., Hertz v. Fiscus,*98 Idaho 456, 567 P.2d 1 (1977). We believe this principle is applicable here. If a trial court reaches the right result, albeit upon an erroneous theory, its decision will be upheld upon the correct theory. *E.g., Andre v. Morrow,*106 Idaho 455, 680 P.2d 1355 (1984). Accordingly, our task is to determine whether the payments ordered by the district court can be upheld as restitution for unjust enrichment.

A

We turn first to the buyers’ claims. As noted earlier, the buyers made a $10,000 down payment. They also paid, in round figures, $850 for feed, $140 for a welder and $668 for other expenses incurred while attempting to operate the ranch. The district judge further found, upon substantial evidence, that the buyers had furnished *235$2,000 in labor and materials to make necessary repairs on the roof of the ranch house and had provided other labor for nonspecific tasks, for which a fair wage would have been $1,200. Of these amounts, the buyers had been reimbursed $355, leaving a net claim of about $14,503. The court awarded this approximate sum.

Although such an award might have been appropriate for restoring the buyers to their pre-“contract” status quo, it was not entirely proper upon a theory of unjust enrichment. The measure of restitution for unjust enrichment is the benefit conferred which it would be unjust for the other party to retain. *Marshall v. Bare,*107 Idaho 201, 687 P.2d 591 (Ct.App.1984). In *Gillette v. Storm Circle Ranch,*101 Idaho 663, 619 P.2d 1116 (1980), our Supreme Court held that the measure of unjust enrichment is not necessarily the value of labor and materials provided. However, in *Hartwell Corp. v. Smith,*107 Idaho 134, 686 P.2d 79 (Ct.App.1984), we noted that while the value of labor and materials is not the measure, per se, of the benefit conferred, it may be competent evidence of the value.

Applying these rules to the buyers’ claims, there is an obvious correlation between the $10,000 down payment and the resultant benefit conferred upon the sellers. The $850 paid for feed also produces a direct, equivalent benefit. The sum of these items is $10,850. After deducting the $355 reimbursed, the buyers’ entitlement, so far as we can determine it on the present record, is $10,495.

However, the record does not permit us to determine the benefit derived by the sellers from the roof repairs. The district judge found that the repairs were necessary and that the buyers had furnished $2,000 in labor and materials. Those findings are not clearly erroneous and will not be set aside. But neither are they dispositive on a question of unjust enrichment. The benefit to the sellers must be ascertained. It may or may not be $2,000. Similarly, we are unable to determine whether the sellers derived a benefit, and to quantify the benefit, if any, resulting from the other items claimed by the purchasers— their miscellaneous expenditures, their labor for nonspecific tasks and their purchase of a welder (the necessity of which was disputed). These items require further analysis and fact-finding in light of the standards governing recovery for unjust enrichment. A remand for this purpose is appropriate.

B

The sellers have resisted any award to the buyers, arguing that the buyers’ conduct in “breaching” the “contract” should bar a court of equity from coming to their aid. Practitioners are familiar with the maxim that a party who seeks equity must enter the court with “clean hands.” *Malcolm v. Hanmer,*64 Idaho 66, 82, 127 P.2d 331, 338 (1942). More specifically, “a litigant may be denied relief by a court of equity on the ground that his conduct has been inequitable, unfair and dishonest, or fraudulent and deceitful as to the controversy in issue.” *Gilbert v. Nampa School District No. 131,*104 Idaho 137, 145, 657 P.2d 1, 9 (1983). A court has discretion to evaluate the relative conduct of both parties and to determine whether the conduct of the party seeking an equitable remedy should, in the light of all the circumstances, preclude such relief. *Id.*at 145-46, 657 P.2d at 9-10.

Here, the district court made no finding of unfair, dishonest, fraudulent, deceitful or inequitable conduct by either party. If either party acted to the detriment of the other, it was simply by failing to perform a contract later determined to be unenforceable. We conclude, and we think the district judge implicitly concluded, that neither party acted in obvious bad faith nor was wholly at fault for the collapse of the ranch sale and partnership. Consequently, neither of them was barred by the “clean hands” doctrine from obtaining restitution for unjust enrichment.

*236C

The sellers also have contended that even if the buyers are entitled to restitution, the sellers should receive offsets against the amount awarded. The sellers have sought recovery of expenses relating to their purchase of the house in Preston, together with the costs of moving from the ranch to the house. They also have claimed the cost of hiring help for the mink ranch after the buyers quit the premises. These items might have been appropriate components of a damage award if the court had determined that a contract existed and that the buyers had breached it. But they are not appropriate elements of restitution for unjust enrichment. They do not represent benefits conferred upon the buyers. Consequently, we find no error in the court’s failure to allow such offsets.

However, the sellers have asserted two other claims upon which we deem the court’s findings to be confusing or inadequate. First, the sellers have claimed that the buyers were unjustly enriched by living at the ranch for several months without paying rent. The court found that any reasonable rental value should be treated as partial compensation for the buyers’ labor. However, the court also found that the rental value was outweighed by income from ranch operations ultimately realized by the sellers after the buyers departed. The court made no findings concerning the rental value of the premises or the amount of income received. We cannot reconcile these seemingly different approaches to the rental value question. In any event, we cannot say whether one party has received a benefit for which the other should pay.

Secondly, the sellers have claimed that the buyers negligently cared for the mink while operating the ranch, causing some 42 females and 6 males to die during a period when the typical losses would have been approximately 10 females and 2 males. Values of $30 per female and $45 per male were placed on the animals, indicating a total loss of approximately $1,140. The sellers’ allegation of negligence was hotly disputed by the purchasers. The district court made no findings. This claim sounds in tort and therefore is not subject to the unjust enrichment limitation we have imposed upon the other claims asserted by the parties.

Upon the present record, we cannot dispose of the issues relating to rent-free housing, income from the ranch and the alleged loss of mink. Consequently, these issues must be determined on remand, together with the unresolved buyers’ claims identified in Part III-A above. The award of restitution to the buyers, which we have upheld today in the sum of $10,495, may be augmented or diminished accordingly.

In summary, the judgment of the district court is affirmed insofar as it declares the contract to be unenforceable. With respect to the monetary award, the amount is modified to $10,495 and the case is remanded for a determination of whether any further adjustment to this sum is appropriate, consistent with our opinion. There being no clearly prevailing party, we decline to award costs or attorney fees on appeal.

WALTERS, C.J., and SWANSTROM, J., concur.