#### ASSOCIATED INDUSTRIAL DEVELOPMENTS, INC., a California corporation, Plaintiff and Respondent, v. J. Paul JEWKES and Lorna Jewkes, husband and wife, Defendants and Appellants.

No. 19374.

Supreme Court of Utah.

Nov. 1, 1984.

Rehearing Denied May 21, 1985.

*487E. Hal Vesick, Provo, for defendants and appellants.

Dave McMullen, Payson, for plaintiff and respondent.

ZIMMERMAN, Justice:

Plaintiff and defendants entered into various agreements respecting a piece of real property, culminating in a 1981 agreement providing for sale of the property to defendants. Defendants then mortgaged it back to plaintiff by way of a trust deed and a promissory note. The trust deed provided that in the event of default, it could be foreclosed upon like a mortgage. Defendants defaulted and plaintiff commenced a foreclosure action under the Code. U.C.A., 1953, §§ 78-37-1 to -9 (1977 ed.). Plaintiff sought judgment for the total principal sum plus interest, reasonable attorney fees and court costs, and for a decree authorizing a sheriff’s sale of the property and providing for a subsequent deficiency judgment, if necessary. Defendants counterclaimed. They first contended that prior to the 1981 sale plaintiff had agreed to take certain steps with respect to the property but had not performed. Defendants next argued that they had made certain improvements to the property and that if plaintiff were permitted to foreclose, plaintiff would receive not only the bargained-for security, but also the substantial additions in value made to the property by defendants. Defendants urged the court not to permit the resulting unjust enrichment.

At a trial on the merits, the court ruled that plaintiff was entitled to foreclose the trust deed as a mortgage at a sheriff’s sale and to a judgment for attorney fees, measured by ten percent of the principal amount of the debt. The court found no merit in defendants’ unjust enrichment claim. The court also ruled that all of plaintiff’s preexisting obligations to defendants had merged into the promissory note and trust deed, thus extinguishing any obligations not set forth in those two documents. Defendants appeal both the decree of foreclosure and the judgment for attorney fees. We affirm.

First, defendants contend that they are entitled to equitable relief for plaintiff’s supposed failure to keep certain commitments required by the terms of agreements made prior to the 1981 transaction. The 1981 contract specifically stated that “all prior agreements [,] understandings and obligations will be merged into the trust deed note and trust deed.” The trial court found that this provision merged and extinguished all preexisting obligations of all parties. Defendants contend that the trial court’s ruling was in error. We disagree. The trial court’s ruling comports with the language of the instrument, which clearly displays the intent of the parties that the 1981 agreement supersede all prior agreements. Under such circumstances, merger occurs. *See Foote v. Taylor,*Utah, 635 P.2d 46 (1981). *See generally*17 Am. Jur.2d *Contracts*§ 483 (1964).

Second, defendants claim that if the sheriff’s sale were to be held, an unjust loss would result to them and plaintiff would obtain an equally unjust enrichment. The factual basis for this claim is the assertion that plaintiff will buy in at the sale and obtain the property and improvements for the amount due on the note, an amount ■allegedly far less than the market value of the property and improvements. Defendants rely on *Perkins v. Spencer,*121 Utah 468, 243 P.2d 446 (1952), to support their claim that this result would be unjust. That case is inapplicable here. *Perkins*concerned a forfeiture under a written contract. The trial court permitted defendants to retain the entire amount paid in under the contract as liquidated damages. This Court found that the designated amount *488bore no reasonable relationship to defendants’ actual damages suffered as a result of the default. Under long-accepted principles, we refused to enforce the forfeiture provision on the ground that to require payment of the amount called for would be unconscionable. *Id.,*121 Utah at 477-78, 243 P.2d at 451.

The holding in *Perkins*is far removed from a statutory foreclosure. While the price obtained at a sheriffs sale may be less than the fair market value of the property and improvements, we cannot assume that this will be the ease. Nor is it true that the purchaser at such a sale, and the beneficiary of any resulting bargain purchase, will necessarily be the mortgagee. And even if that were to occur, the mortgagor/buyer may redeem within six months, subject only to statutory reimbursement items. Utah R.Civ.P. 69(f)(3). Under the circumstances of this case, we have no basis for finding that the ordinary operation of a statutory foreclosure proceeding will result in an unjust enrichment of the mortgagee, much less that it will be actionable for unconscionability.

Finally, defendants claim that the attorney fees awarded plaintiff by the trial court were excessive. Based upon the record before us, we find that the trial court utilized an improper standard to determine the amount to be awarded, but we decline to reverse.

The Code provides in pertinent part:

> In all cases of foreclosure when an attorney’s fee is claimed by the plaintiff, the amount thereof shall be fixed by the court, any stipulation to the contrary notwithstanding; provided, no other or greater amount shall be allowed or decreed than the sum which shall appear by the evidence to be actually charged by and to be paid to the attorney for the plaintiff.

U.C.A., 1953, § 78-37-9 (1977 ed.). The proper standard for the trial court’s setting attorney fees under this statutory provision was articulated in *Jensen v. Lichtenstein,*45 Utah 320, 145 P. 1036 (1914). The fee is to be reasonable under all the facts and circumstances, and the court must undertake its own inquiry into reasonableness, basing its conclusions on evidence in the record. *Id.,*45 Utah at 325-26, 145 P. at 1038; *accord, Beals v. Beals,*Utah, 682 P.2d 862, 864 (1984); *Delatare v. Delatore,*Utah, 680 P.2d 27, 28 (1984). In *Jensen,*a case dealing with the assessment of attorney fees in a mortgage foreclosure action, the scope of that inquiry is discussed:

> It should not be assumed by the court that, simply because the parties have named 10 per cent., or any other amount, in either the note or the mortgage, that that is the amount that should be allowed. The trial courts, in each case, become familiar with all the issues, know just what the facts and circumstances developed at the hearing are, and thus are in a position to arrive at an intelligent and just conclusion respecting the amount that should be allowed as the reasonable fee contemplated by our statute.

*Jensen v. Lichtenstein,*45 Utah at 326, 145 P. at 1038.

In the instant case, the trial court failed to independently review the facts and fix the attorney fee based upon that evidence. The court heard evidence from plaintiff’s president that he had agreed to pay his attorney a fee of ten percent of the $265,770 debt. However, according to the statute and cases, such a stipulation is not controlling. The court also heard evidence from a local attorney, who testified that ten percent of the principal amount of the debt is a reasonable fee in all mortgage foreclosure cases. While *Jensen*states that such testimony may be helpful, it cannot substitute for the trial court’s own full inquiry into the matter. A variety of factors ought to be considered. “What is reasonable ..., in a large measure at least, must depend upon the amount in controversy, the labor, and responsibility imposed upon the attorney in obtaining judgment ” *Id.,*45 Utah at 325-26, 145 P. at 1038. Logically, the attorney claiming the fee ought to be a valuable and relevant source of information concerning the com*489position of that fee. In this case, although plaintiffs attorney offered to testify, his testimony was not received. By precluding it, the trial court abrogated its responsibility to undertake a full inquiry. This was error. We do not reverse, however, because defendant’s attorney led the court into the error of the *manner*in which the testimony of plaintiffs attorney was precluded.

According to the transcript, when plaintiffs attorney offered to testify in support of his fee, defendant’s attorney objected on the ground that “attorneys are not permitted to testify in cases in which they represent [a party].” This objection was without any legal foundation.1 The trial court erroneously sustained the objection. Defense counsel now asks this Court to reverse the attorney fee award, arguing without any record support that the work required of plaintiff’s counsel could not possibly have taken more than 50 hours and, therefore, that a reasonable fee could not exceed the local going rate multiplied by 50 — a rate that certainly would be far less than the $531.54 per hour the court’s award produces. Ironically, by objecting to plaintiff’s attorney’s testimony, defense counsel succeeded in keeping out of the record the precise evidence that might have corroborated his contention as to the amount of time required for the work. Although he might very well have established the unreasonableness of the fee on cross-examination, his own conduct prevented 1⁄8. Because defendant’s counsel succeeded in keeping out testimony of the number of hours expended by plaintiff’s counsel, there is no basis for concluding that 50 hours or 500 hours was a reasonable expenditure of time. Defense counsel cannot successfully object at trial to plaintiff’s counsel’s testimony about his fee and then complain on appeal that plaintiff has failed to prove the reasonableness of the fee. *Cf. Kohler v. Garden City,*Utah, 639 P.2d 162, 165 (1981); *Hickman v. Haughton Elevator Co.,*268 Or. 192, 195, 519 P.2d 369, 373 (1974). Defendant has waived any objection to the attorney fee by his preclusion of plaintiff’s attorney’s testimony.

The judgment is affirmed.

HALL, C.J., and STEWART, HOWE and DURHAM, JJ., concur.

1

. Our canons do proscribe an attorney’s giving testimony in a case in which he is employed as counsel. However, an exception to that canon expressly allows such testimony when it relates "solely to the nature and value of legal services rendered in the case by the lawyer ... to the client.” Rev.Rules of Professional Conduct of the Utah State Bar, DR5-101(B) (1977).