
660 N.W.2d 530 (2003)
11 Neb. App. 722
AMERICAN NATIONAL BANK, a National Banking Association, Appellant,
v.
Gregory R. CLARK and Cheryl Ann Clark, husband and wife, et al., Appellees.
No. A-01-1009.
Court of Appeals of Nebraska.
April 22, 2003.
*532 Emmett D. Childers, of Hillman, Forman, Nelsen, Childers & McCormack, for appellant.
Douglas E. Quinn and Michael T. Eversden, of McGrath, North, Mullin & Kratz, P.C., Omaha, for appellees.
HANNON and MOORE, Judges, and BUCKLEY, District Judge, Retired.
BUCKLEY, District Judge, Retired.

INTRODUCTION
American National Bank (ANB) appeals from an order of the district court for Douglas County denying ANB a summary judgment request to foreclose as a mortgage the deed of trust in its favor, encumbering the residential real property owned by Gregory R. Clark and Cheryl Ann Clark, husband and wife. The court found that the Clarks and their mortgagee, First Union Mortgage Corporation (First Union), should be equitably subrogated to the lien rights of two previous lenders, North American Savings Bank (North American) and First Bank, whose liens had been released and discharged of record. The trial court also found that ANB could not foreclose on the property without the Clarks' and First Union's consent. For the reasons set forth below, we affirm in part, and in part reverse and remand with directions for the court to modify the subrogation amount and for further proceedings.

BACKGROUND
This suit arises out of the sale of residential real property by Michael Tesmer and Lori Tesmer, husband and wife, to the Clarks in December 1997. Prior to the sale, the Tesmers owned the residence subject to three deeds of trust, the first to North American in the amount of $100,388.44 and the second to First Bank *533 in the amount of $98,165.82. ANB held the third deed of trust in the amount of $187,500. This third deed of trust was recorded on March 7, 1997. This particular deed of trust was taken by the Tesmers in connection with the startup of their business called Seven T's, a Nebraska limited liability company, doing business as Candleman No. 34. The loan was personally guaranteed by the Tesmers by written guaranty.
On December 1, 1997, the Tesmers sold the property to the Clarks by means of a warranty deed. In order to purchase the property, the Clarks took out a loan from First Union and executed a deed of trust to First Union. Besides their loan from First Union, the Clarks put down $29,201.13 and an earnest deposit of $3,000. Gregory Clark's employer also contributed $6,540. The Tesmers contributed the sum of $12,256.24. This total amount was used to satisfy the first two deeds of trust the Tesmers had given to North American and First Bank.
Previous to their purchase of the property, the Clarks and First Union secured a title report from Security Land Title & Escrow Company (Security). That report showed the Tesmers' deeds of trust to North American and First Bank, but failed to show the Tesmers' deed of trust to ANB.
On April 1, 1999, Jeannette Lewis, an escrow officer for Security, received a telephone call from Tod Ellis, an ANB employee. During that call, Ellis asked Lewis when ANB could expect a check from the Tesmers' sale of their residence. Ellis told Lewis that Lori Tesmer had filed for divorce and wanted to be released from ANB's deed of trust.
The Tesmers failed to pay ANB the monthly payments due on their promissory note on May 3, 1999, and each month thereafter. Subsequently, ANB declared the Tesmers' loan in default. On July 15, ANB elected to exercise the power of sale under the deed of trust on the property by recording a notice of default with the Douglas County register of deeds. The Tesmers failed to cure the default within 1 month.
On November 24, 1999, ANB filed a petition for foreclosure against the Clarks, First Union, and First American Title Insurance Company, First Union's trustee (collectively the defendants). ANB seeks foreclosure on the Clarks' property to recover the principal sum of $146,547.88 owing to ANB on the guaranty secured by the Tesmers' deed of trust, in addition to interest.
On September 22, 2000, the defendants filed a third amended answer requesting that they be awarded judgment under the principles of equitable subrogation and that First Union be declared to have a lien prior to that of ANB.
On March 19, 2001, the defendants filed a motion for partial summary judgment. In the motion, the defendants stated that First Union's lien is superior to that of ANB and that no genuine issues of fact remained in that regard.
On March 23, 2001, ANB filed a motion for summary judgment stating that it was entitled to summary judgment on its foreclosure action since the pleadings, admissions, and affidavits show that there is no genuine issue of material fact.
On April 2, 2001, the court held a hearing on the parties' motions for summary judgment. Both ANB and the defendants filed affidavits in support of their motions for summary judgment.
In an order filed May 24, 2001, the trial court granted the defendants' motion for partial summary judgment and overruled ANB's motion for summary judgment. *534 The court stated that at the very least, First Union had an implied agreement with the Clarks to be first in priority after its loan funds were used to pay off the mortgages held by North American and First Bank. The trial court stated that First Union loaned the Clarks money with the expectation of being substituted in the place of North American and First Bank. The court stated that ANB could seek foreclosure of the property, but only (1) with First Union's consent and (2) after ANB redeemed the senior mortgage held by First Union. Stating that there was no evidence of such in the record, the court concluded that as a matter of law, ANB could not seek judicial foreclosure of the Clark's property by summary judgment.
On June 4, 2001, ANB filed a motion to alter or amend the judgment or for a new trial.
After a hearing, the trial court filed an order on August 8, 2001. In that order, the trial court found that both the Clarks and First Union are entitled to be conventionally subrogated to the rights of the preexisting lenders, North American and First Bank. The trial court found the total amount of the Clarks' and First Union's liens to be $208,440.15, plus interest at the legal rate commencing December 1, 1997. In so finding, the trial court included the following amounts: (1) Clarks' downpayment of $3,000; (2) First Union's loan to the Clarks of $157,442.78; (3) funds of $29,201.13 advanced by the Clarks at closing; (4) the Tesmers' contribution of $12,256.24; and (5) First Union's billed cost of $6,540.
ANB appeals.

ASSIGNMENTS OF ERROR
ANB's assignments of error on appeal, restated, are that the court erred in (1) entering partial summary judgment in favor of the defendants and finding as a matter of law that the Clarks and First Union are entitled to be conventionally subrogated to the prior existing mortgage liens of North American and First Bank; (2) denying ANB's motion for summary judgment and failing to enter a decree of foreclosure in favor of ANB; and (3) finding the total amount of the Clarks' and First Union's liens to be $208,440.15, plus interest at the legal rate commencing December 1, 1997.

STANDARD OF REVIEW
Generally, the denial of a motion for summary judgment is not a final, appealable order. However, when adverse parties have each moved for summary judgment and the trial court has sustained one of the motions, the reviewing court obtains jurisdiction over both motions and may determine the controversy which is the subject of those motions or make an order specifying the facts which appear without substantial controversy and direct further proceedings as it deems just. Neff Towing Serv. v. United States Fire Ins. Co., 264 Neb. 846, 652 N.W.2d 604 (2002).
Summary judgment is proper when the pleadings, depositions, admissions, stipulations, and affidavits in the record disclose that there is no genuine issue as to any material fact or as to the ultimate inferences that may be drawn from those facts and that the moving party is entitled to judgment as a matter of law. Soukop v. ConAgra, Inc., 264 Neb. 1015, 653 N.W.2d 655 (2002).
On a motion for summary judgment, the question is not how a factual issue is to be decided, but whether any real issue of material fact exists. Egan v. Stoler, 265 Neb. 1, 653 N.W.2d 855 (2002). In reviewing a summary judgment, an appellate court views the evidence in the light most favorable to the party against whom the *535 judgment is granted and gives such party the benefit of all reasonable inferences deducible from the evidence. Id.

ANALYSIS

Defendants' Motion for Summary Judgment.
On appeal, ANB argues that the trial court erred in entering partial summary judgment in favor of the defendants and finding as a matter of law that the Clarks and First Union are entitled to be conventionally subrogated to the prior existing mortgage liens of North American and First Bank.
Conventional subrogation arises where one pays the debt of another under an agreement, existing at the time of the payment, with either the debtor or the creditor, that the person paying shall be subrogated to the liens existing as security for the debt. Hoppe v. Phoenix Homes, Inc., 211 Neb. 419, 318 N.W.2d 878 (1982). The doctrine of conventional subrogation must be distinguished from the doctrine of legal subrogation, which exists only in favor of the surety for the payment of the debt or one who is compelled to pay the debt to protect his own rights. See id.
Conventional subrogation arises by reason of either an express or an implied agreement between the third person paying the debt and either the debtor or creditor. Id. The applicability of the doctrine of conventional subrogation in any particular case depends upon its particular facts and circumstances, the principle not being enforced as a matter of legal right, but in order to subserve the ends of justice in the particular controversy under consideration. Id.
A person with interest in property who pays off an encumbrance on the property in order to protect his or her interest is ordinarily entitled to be subrogated to the rights and remedies of the person paid, provided the debt secured by the encumbrance is not one for which the payor is primarily liable, and the grant of such relief is equitable. Id. One who pays or advances money to pay a mortgage debt with the understanding that he or she is to have the benefit of the mortgage becomes the holder of the lien by subrogation, although the creditor is not a party to the agreement. Id.
In support of its position that the defendants are not entitled to conventional subrogation, ANB cites Rice v. Winters, 45 Neb. 517, 63 N.W. 830 (1895), and Bohn Sash & Door Co. v. Case, 42 Neb. 281, 60 N.W. 576 (1894), in which the Supreme Court rejected the appellants' claims of subrogation.
The defendants argue that later case law expanded the application of conventional subrogation, citing Hoagland & Co. v. Decker, 118 Neb. 194, 224 N.W. 14 (1929). The defendants argue that Decker distinguished Rice and Bohn Sash & Door Co. in such a way "as to make Rice and Bohn [Sash & Door Co.] of little continued validity." Brief for appellee at 25.
In Decker, 118 Neb. at 198-99, 224 N.W. at 15-16, the Nebraska Supreme Court stated:
Appellees insist that, if subrogation is granted in this case, Bohn Sash & Door Co. v. Case, [supra,] and Rice v. Winters, [supra,] must be overruled. We do not so understand the holdings in those cases. It does not appear in the Rice case that there was an agreement with the debtor to give a first lien by the new mortgage to take the place of the older mortgage, nor in the Rice case or Bohn case that the persons who advanced the money to take up the prior valid mortgages were relying upon their new securities to take the place of the old ones. *536 Commissioner Ryan in the Bohn case, [42 Neb. at 298, 60 N.W. at 581,] says: "It is not enough to entitle to subrogation that with the proceeds of [a new] mortgage prior mortgages have been discharged. `The real question in all such cases is whether the payment made by the stranger was a loan to the debtor through a mere desire to aid him or whether it was made with the expectation of being substituted in the place of a creditor. If the former is the case, he is not entitled to subrogation; if the latter, he is.'"
(Emphasis supplied.)
Therefore, the main question in the instant case is whether First Union made a loan to the Clarks with a mere desire to aid them or whether it made the loan with the expectation of being substituted in the place of North American and First Bank.
The trial court found that First Union loaned the Clarks money with the expectation of being substituted in the place of North American and First Bank. The trial court stated that at the very least, First Union had an implied agreement with the Clarks to be first in priority after its loan funds were used to pay off the mortgages held by North American and First Bank. The record supports the trial court's findings. At the summary judgment hearing, the defendants offered into evidence the "General Closing Instructions" First Union issued to Security. In those instructions, it states that the title policy was to "insure that the security instrument constitutes a valid first lien on the [b]orrower's fee simple (or acceptable leasehold) estate on the mortgaged premises." Additionally, in an affidavit, the vice president of Security stated that Security paid the mortgages owed to North American and First Bank to place First Union in the first lien position. Furthermore, the deed of trust granted to First Union by the Clarks required the Clarks to "promptly discharge any lien which has priority over this [s]ecurity [i]nstrument." Clearly, as the trial court found, there was an agreement that First Union loaned the Clarks money with the expectation that it would be substituted in the place of North American and First Bank. Additionally, to deny the Clarks and First Union subrogation in the instant case would result in a windfall to ANB. Therefore, the trial court did not err in finding that as a matter of law, First Union has first lien priority on the property under the doctrine of conventional subrogation.

ANB's Motion for Summary Judgment.
ANB argues that even if the trial court was correct in its finding of conventional subrogation, ANB is still entitled to "obtain a [d]ecree of foreclosure of its mortgage entitling it to a [s]heriff's sale of its mortgage interest and of the equity of redemption of the owner of the [p]roperty." Brief for appellant at 37.
In its order, the trial court found that ANB had the authority to seek foreclosure of the property, but could not do so until the Clarks and First Union consented and until ANB redeemed the senior mortgage held by First Union. Because the trial court found no evidence that ANB had done either of these things, the court found that as a matter of law, ANB could not seek judicial sale of the property at that time. The trial court's ruling is not consistent with Nebraska law. In Hoppe v. Phoenix Homes, Inc., 211 Neb. 419, 425, 318 N.W.2d 878, 882 (1982), the Nebraska Supreme Court stated that "junior lienholders are entitled to the same treatment as anyone else in a foreclosure of real estate and are entitled to have the property sold at public auction and await the outcome of the purchase price." Furthermore, under Nebraska law, ANB is entitled *537 to foreclose its own lien on the Clark's property without the Clark's and First Union's consent, but may not foreclose the Clark's and First Union's liens without first receiving their consent.
Therefore, the trial court erred in overruling ANB's motion for summary judgment and finding that ANB could not seek judicial sale of the Clark's property. ANB is entitled to foreclose its junior lien, but may not foreclose the senior lien held by the Clarks and First Union without their consent.

Amount of Subrogation.
ANB contends that the district court erred in determining the amount to which the defendants are subrogated. Regarding the amount of subrogation, "[t]he general rule is that a subrogee is entitled to indemnity to the extent only of the money actually paid by him to discharge the obligation, or the value of the property applied for that purpose." 73 Am.Jur.2d, Subrogation § 67 at 599 (2001). The district court stated that the defendants were subrogated in the amount of $208,440.15. In that amount, the trial court included the $12,256.24 contribution from the Tesmers. Because the defendants did not pay that amount, the trial court should have found that the defendants are subrogated in the amount of $196,183.91, plus interest. We note plain error in that the trial court stated that the Clarks and First Union are entitled to interest at the legal rate. Instead, the trial court should have found that the Clarks and First Union are entitled to interest at the contractual rate.

CONCLUSION
After reviewing the record, we conclude that the trial court did not err in entering partial summary judgment in favor of the defendants and finding as a matter of law that the Clarks and First Union are entitled to be conventionally subrogated to the prior existing mortgage liens of North American and First Bank. The trial court did err in failing to grant summary judgment in ANB's favor. The trial court also erred in the total amount of the Clarks' and First Union's subrogation liens. Therefore, we affirm in part, and in part reverse and remand with directions for the court to modify the subrogation amount and for further proceedings in accordance with this opinion.
AFFIRMED IN PART, AND IN PART REVERSED AND REMANDED WITH DIRECTIONS.
