
316 Md. 405 (1989)
559 A.2d 365
ALBERT J. BACHMANN, JR. ET UX.
v.
GLAZER & GLAZER, INC.
No. 105, September Term, 1988.
Court of Appeals of Maryland.
June 19, 1989.
Alan Hilliard Legum (Legum & Henley, P.A., both on brief), Annapolis, for appellant.
Mitchell Stevan (Weinberger, Weinstock, Sagner, Stevan & Harris, P.A., both on brief), Baltimore, for appellee.
Argued before ELDRIDGE, COLE, RODOWSKY, McAULIFFE, ADKINS and BLACKWELL, JJ., and MARVIN H. SMITH, Associate Judge of the Court of Appeals of Maryland (retired), Specially Assigned.
MARVIN H. SMITH, Judge, Specially Assigned.
We shall here hold that a guarantor of rent is not released from his obligation when a third party pays that debt pursuant to an agreement with a creditor of the tenant that the third party shall have an assignment of the creditor's claim.
Appellants, Albert J. Bachmann, Jr., and Evelyn Bachmann, his wife (the guarantors), were the guarantors of a commercial lease between A.J.B. Clothiers, Inc. (the tenant) and The Village of Cross Keys, Incorporated (the landlord). The lease was assigned to appellee Glazer & Glazer, Inc. (Glazer).

I
This appeal is one from a grant of summary judgment. Under Maryland Rule 2-501 summary judgment is to be rendered forthwith "if the pleadings, depositions, answers to interrogatories, admissions, and affidavits show that there is no genuine dispute as to any material fact and that the party in whose favor judgment is entered is entitled to judgment as a matter of law." The function of a summary judgment is not to try the case or to attempt to resolve factual issues, but to determine whether there is a dispute as to a material fact sufficient to provide an issue to be tried. See Coffey v. Derby Steel Co., 291 Md. 241, 247, 434 A.2d 564 (1981); Berkey v. Delia, 287 Md. 302, 304, 413 A.2d 170 (1980) (and cases cited therein); Washington Homes v. Inter. Land Dev., 281 Md. 712, 716, 382 A.2d 555 (1978). On review, therefore, we are concerned with whether there was a dispute as to any material fact and, if not, whether the movant was entitled to judgment as a matter of law.
We set forth the facts which we glean from the pleadings, affidavits, and exhibits.
On June 14, 1985, the tenant leased commercial space in Harundale Shopping Center from the landlord. The tenant operated a men's clothing store known as "Gentleman's Quarters." The lease agreement prohibited assignment without the written consent of the landlord. Under an agreement executed the same day as the lease agreement the guarantors guaranteed the rental payments. By the terms of that agreement they could not be released from their obligations as guarantors even if the landlord released the tenant from its obligations. The guaranty agreement also provided that the guaranty would extend to any assignee of the tenant's interest in the lease.
On September 6, 1985, the tenant entered into a promotional sales agreement with Glazer whereby Glazer agreed to supply merchandise on consignment and to act as a sales consultant. Among the remedies reserved to Glazer in the promotional sales agreement, in the event of default by the tenant, is the power of attorney granted to Glazer to assign the lease to Glazer. The guarantors also guaranteed the promotional sales agreement, including "all sums due Glazer & Glazer, Inc.... whether arising out of this agreement or out of any other agreement in writing which Glazer & Glazer, Inc., may make with [the tenant]."
The tenant defaulted on the promotional sales agreement. On December 9, 1987, Glazer exercised the power of attorney to assign itself the lease. At the time of the assignment the tenant owed three months rent amounting to $15,686.99.[1] By letter dated December 9, 1987, the attorney for Glazer transmitted the assignment of lease to counsel for the landlord seeking the landlord's consent. The letter stated that Glazer agreed to pay the tenant's back rent and that in return for this it was agreed that the landlord would "assign to Glazer & Glazer, Inc.... Landlord's claim against [the tenant] and its guarantors for the said past due rent of $15,686.99."[2] In a second letter, also dated December 9, 1987, Glazer's attorney acknowledged that the assignment of the lease would operate for a temporary period of 30 days and that in the intervening 30-day period "the Landlord [would] prepare a lease agreement on its usual form for assignment which, when executed, [would] operate for the remaining term of the lease." The landlord consented to the assignment.
Pursuant to the December 9, 1987, agreement, on December 31, 1987, Glazer paid the landlord the back rent owed by the tenant. On February 9, 1988, Glazer brought suit against the guarantors in the Circuit Court for Anne Arundel County. The trial court granted summary judgment in favor of Glazer for the sum of $12,941.77 and costs. The guarantors appealed to the Court of Special Appeals. We issued a writ of certiorari prior to a determination in that court in order that we might consider the important public question here presented.

II
The guarantors contend that their obligation as guarantors of the tenant's rental payments was discharged when Glazer paid the back rent and that the trial court thus erred in granting summary judgment in favor of Glazer.
We believe this case involves the doctrine of subrogation. Although Glazer did not specifically invoke the doctrine of subrogation, the pleadings contain all of the elements necessary for application of this equitable remedy. On at least two previous occasions this Court has applied the doctrine of subrogation even though the plaintiff did not argue this theory of recovery.
In Schnader, Inc. v. Cole Build. Co., 236 Md. 17, 202 A.2d 326 (1964), a developer (Schnader) purchased 38 lots from another developer (Cole) who had failed to fulfill a public works agreement on other lots not purchased by Schnader. Schnader was the assignee of the public works agreement between the county and Cole. The county would not allow Schnader to pave the streets on his property until the streets on Cole's property were paved. Schnader was forced to pay the cost of the uncompleted portion of the public works agreement on Cole's lots in order to save his $500,000 investment. The trial court ruled that Schnader had paid the money to the county as a "volunteer." Schnader had advanced several theories of recovery at trial, none of which was the doctrine of subrogation. Nevertheless, this Court held that Schnader was entitled to recover under that doctrine because his pleadings satisfied the requisite elements. 236 Md. at 24-25, 202 A.2d 326. That case was one involving legal subrogation. The essential elements are: (1) the existence of a debt or obligation for which a party, other than the subrogee, is primarily liable, which (2) the subrogee, who is neither a volunteer nor an intermeddler, pays or discharges in order to protect his own rights or interests. Id. at 23, 202 A.2d 326.
Maryland Title v. Kosisky, 245 Md. 13, 225 A.2d 47 (1966), is another case involving legal subrogation. The plaintiff did not raise the issue of subrogation but this Court, citing Schnader, held that the application of the doctrine was appropriate if the pleadings alleged the necessary elements and these elements were supported by the facts. 245 Md. at 19, 225 A.2d 47. Mr. and Mrs. Kosisky sold a house and deposited the proceeds in escrow with the settlement agent, Sapero, pending settlement on their new house. The money was held under an irrevocable trust for the vendor of the new home. Maryland Title was advised of the escrow account. The money in the escrow account was not received on the day of settlement and Maryland Title paid the vendor from its own funds. When it was unable to collect from Sapero, Maryland Title sued the Kosiskys. This Court determined that the title company would have had a right of subrogation against the Kosiskys but for the fact that the right of subrogation can be lost by agreement. Id. at 21, 225 A.2d 47. Maryland Title knew the money was to come from Sapero and acquiesced in looking to Sapero for payment by making a notation to this effect on the settlement sheet.
We are here presented with another situation where a plaintiff has not specifically invoked the doctrine of subrogation, but, as in Schnader and Maryland Title, all of the elements of this doctrine have been pleaded and proved. Glazer is thus entitled to recover under the doctrine of subrogation.
The Supreme Court of the United States has observed that subrogation is one of the oldest of the equitable doctrines evolved by the courts. Under the doctrine of subrogation "one who has been compelled to pay a debt which ought to have been paid by another is entitled to exercise all the remedies which the creditor possessed against that other." Amer. Surety Co. v. Bethlehem Bank, 314 U.S. 314, 317, 62 S.Ct. 226, 228, 86 L.Ed. 241 (1941) (citing H. Sheldon, The Law of Subrogation § 11 (2d ed. 1893).
Subrogation is founded upon the equitable powers of the court. It is intended to provide relief against loss and damage to a meritorious creditor who has paid the debt of another. Milholland v. Tiffany, 64 Md. 455, 460, 2 A. 831 (1886). The doctrine is a legal fiction whereby an obligation extinguished by a payment made by a third person is treated as still subsisting for the benefit of this third person. Harford Bank v. Hopper's Estate, 169 Md. 314, 324, 181 A. 751 (1935) (citing Aetna Life Ins. Co. v. Middleport, 124 U.S. 534, 8 S.Ct. 625, 31 L.Ed. 537 (1888)). This third person succeeds to the rights of the creditor in relation to the debt. Finance Co. of Am. v. U.S.F. & G. Co., 277 Md. 177, 182, 353 A.2d 249 (1976) (and cases cited therein); Schnader, 236 Md. at 22, 202 A.2d 326. The rationale underlying the doctrine of subrogation is to prevent the party primarily liable on the debt from being unjustly enriched when someone pays his debt. Security Ins. Co. v. Mangan, 250 Md. 241, 246-47, 242 A.2d 482 (1968). See also 10 S. Williston, A Treatise on the Law of Contracts § 1265 at 845 (W. Jaeger 3d ed. 1967):
"The object of subrogation is the prevention of injustice. It is designed to promote and to accomplish justice, and is the mode which equity adopts to compel the ultimate payment of a debt by one, who, in justice, equity, and good conscience, should pay it. It is an appropriate means of preventing unjust enrichment. The doctrine of subrogation is applied to ... do equity in the particular case under consideration."
Since a person entitled to subrogation stands in the shoes of the creditor, he is ordinarily entitled to all the remedies of the creditor, and he may use all the means which the creditor could employ to enforce payment. Poe v. Phila. Casualty Co., 118 Md. 347, 352-53, 84 A. 476 (1912). This means that a subrogee can enforce the obligation of a guarantor of the debtor.
There are three separate categories of subrogation recognized in Maryland: legal subrogation, conventional subrogation, and statutory subrogation. Finance Co. of Am., 277 Md. at 182, 353 A.2d 249. Legal subrogation arises by operation of law whereby a third party who pays a debt to protect his own interests is deemed to be entitled to reimbursement. Security Ins. Co. v. Mangan, 250 Md. at 246-47, 242 A.2d 482. Conventional subrogation arises by an express or implied agreement; i.e., by contract. Id. at 246, 242 A.2d 482. Statutory subrogation arises by act of a legislature. See, e.g., Maryland Code (1983) § 15-401, Commercial Law Article, which codifies a surety's common law right of subrogation. Subrogation by assignment, such as we have in the instant case, is a form of conventional subrogation as Judge Singley pointed out for the Court in Security Ins. Co. v. Mangan, 250 Md. at 246, n. 7, 242 A.2d 482. He said, "[A]ssignment of the ... right of recovery [gives] rise to conventional subrogation." Id. at 249, 242 A.2d 482.
The case before us involves conventional subrogation. Conventional subrogation is founded upon an agreement, express or implied, between a debtor and a third party or between a creditor and a third party that, upon payment of the debt, the third party will be entitled to all the rights and securities of that debtor or that creditor. See Security Ins. Co. at 246, 242 A.2d 482; Harford Bank, 169 Md. at 327, 181 A. 751. Under the agreement between Glazer and the landlord reached December 9, 1987, Glazer agreed to pay the tenant's back rent and the landlord agreed to assign to Glazer the lease and the landlord's claim against the tenant and the tenant's guarantors.[3]
The guarantors contend that the tenant's debt had not been assigned to Glazer when Glazer paid the debt on December 31, 1987. They point to an "Assignment and Amendment of Lease" executed by the landlord and Glazer in February or March, 1988, but dated December 9, 1987. (We have not been given the exact date.) From this they argue that an assignment of a debt subsequent to payment of the debt cannot revive it. They have ignored the assignment of lease executed by Glazer pursuant to its power of attorney on December 9, 1987, consented to at that time by the landlord, and the two letters of the same date from Glazer's attorney to the landlord's attorney. Although the assignment of lease does not mention the assignment of the debt, the letter which accompanied the assignment states that Glazer accepted the responsibility for the past due rent in return for an assignment of the claim against the tenant and its guarantors. The second letter adds to the assignment the acknowledgment that the assignment was to operate for a temporary period of 30 days and that a subsequent agreement was to be prepared on the landlord's "usual form of assignment" for the remaining term of the lease. A contract may consist of more than one document. The assignment of lease and the two letters constitute a contract in this case. See, e.g., Rothman v. Silver, 245 Md. 292, 295-96, 226 A.2d 308 (1967) (the agreement of the parties was integrated in four documents consisting of an agreement of sale dated January 24 and three other documents executed February 7 which were contemplated in the January 24 writing).
When a contract is comprised of more than one document, the writings are to be read and construed together as if they were one instrument. Id. at 296, 226 A.2d 308 (and cases and authorities cited therein) In the instant case the assignment and two letters dated December 9, 1987, together constitute an assignment to Glazer of the lease and also an assignment of the claim for back rent. The subsequent assignment and amendment executed on the landlord's "usual form" was simply a restatement of the terms of the agreement contained in the three December 9, 1987, writings. These four documents constitute a single integrated agreement concerning the transfer of tenant's lease to Glazer.
Contrary to the guarantors' assertion that Glazer paid the back rent with the purpose of extinguishing the debt, Glazer was compelled to pay the debt as a condition to landlord's consenting to the assignment of the lease. The consent of a landlord to an assignment, or his receipt of rent from the assignee, does not affect the lessee's liability for unpaid installments unless the landlord and assignee enter into a new contract which constitutes a novation and a release of the lessee. 49 Am.Jur.2d Landlord and Tenant §§ 440, 442 (1970). In the case at bar there was an assignment, not a new contract. Since the assignee of the lease is not personally liable for rent which accrued prior to his acquisition of the lease (49 Am.Jur.2d Landlord and Tenant § 465), lessee and his guarantor are liable for rent owed prior to the assignment. Glazer was unable to collect the back rent from the tenant who filed a voluntary bankruptcy petition on December 11, 1987. Consequently, Glazer proceeded against the guarantors of the tenant's debt. As the assignee of the landlord's claim against the tenant, Glazer was entitled to sue the tenant's guarantors because assignment of a debt ordinarily carries with it every remedy or security that is incidental to the subject matter of the assignment and that could have been used by the assignor as a means of payment. See Hewell v. Coulbourn, 54 Md. 59, 64 (1880). See also 6 Am.Jur.2d Assignments § 121 (1963).
Assignment of a debt is held to operate as an assignment of a guaranty of the debt. See 38 Am.Jur.2d Guaranty § 36 (1968); 6 Am.Jur.2d Assignments § 121. Discharge of a guarantor can occur only when the lessee's debts have been fully paid or otherwise satisfied. See 38 Am.Jur.2d Guaranty §§ 78, 79 (1968). 38 C.J.S. Guaranty § 77 (1943), says that
"payment or other satisfaction or extinguishment of the principal debt or obligation by the principal, or by any one for him, discharges the guarantor...." (emphasis supplied)
It is evident, however, from the first December 9, 1987, letter and from the documents executed by Glazer that Glazer did not pay the rent "for" the tenant. Glazer paid the rent because the landlord required Glazer to pay it as a condition of granting the assignment.
Recovery on a theory of conventional subrogation is based on contract but it is nevertheless subject to principles of equity. A conventional subrogee is not necessarily entitled to subrogation as a matter of legal right; the relative equities of the parties are still to be balanced. See Finance Co. of Am., 277 Md. at 185, 353 A.2d 249 (citing Maryland Trust Co. v. Poffenberger, 156 Md. 200, 144 A. 249 (1929)); Security Ins. Co., 250 Md. at 247, 242 A.2d 482; Maryland Title, 245 Md. at 20, 225 A.2d 47; Schnader, 236 Md. at 22, 202 A.2d 326. See also 73 Am.Jur.2d Subrogation § 9 (1974); J. Mullen, The Equitable Doctrine of Subrogation, 3 Md.L.Rev. 201, 208-09 (1939).
The equities in the case at bar favor Glazer. Glazer was forced to pay the tenant's debt in order to protect Glazer's interest in the store. The tenant defaulted in December, a busy month for merchants. Glazer had merchandise in the tenant's store which would remain unsold if Glazer did not take over operations at the store. The only way to get the consent of the landlord to the assignment of the lease was to pay the tenant's back rent. Glazer is entitled to be repaid for an expense resulting from the tenant's default on the promotional sales agreement it had with Glazer. There is no equitable argument favoring the guarantors. They promised to pay the rent in the event of the tenant's default.[4] Their guaranty expressly included any assignee of the tenant. To permit the guarantors to escape their obligation would result in unjust enrichment. This is precisely the result that the doctrine of subrogation was created to avoid. See 10 S. Williston, A Treatise on the Law of Contracts, § 1265 at 845.
In any subrogation case, the burden of proving entitlement is on the subrogee. Security Ins. Co., 250 Md. at 248, 242 A.2d 482. In order for Glazer to recover from the guarantors under a theory of conventional subrogation, Glazer needed to prove: (1) that the landlord agreed to assign the debt to Glazer and 2) that Glazer paid the tenant's debt. Glazer proved it received an assignment of the debt on December 9, 1987, and that it paid the debt on December 31, 1987. As we said in Schnader and in Maryland Title, it matters not that Glazer did not use the term "subrogation" in its pleadings. Glazer has established the requisite elements of conventional subrogation and is entitled to recover against the guarantors unless this would be inequitable under the particular circumstances of this case. We find no such inequity here. The guarantors agreed to guarantee the rental payments of the tenant or its assignee. They were liable for the payments immediately upon the default of the tenant. Furthermore, the guarantors are not without a remedy. When a guarantor is compelled to make good his guaranty, he can avail himself of his statutory right of subrogation against the debtor. Maryland Code (1983) § 15-401, Commercial Law Article. Of course, with the tenant in bankruptcy the guarantors may recover nothing from the tenant, but that does not change their liability.
JUDGMENT AFFIRMED; APPELLANTS TO PAY THE COSTS.
NOTES
[1]  Glazer originally sued the guarantors for $15,686.99 but later filed a credit of $2,745.22 recognizing that the tenant was liable for only nine days of rent in December rather than for the entire month.
[2]  A debt which has actual or potential existence is a proper subject of an assignment. Summers v. Freishtat, 274 Md. 404, 407, 335 A.2d 89 (1975); Seymour v. Finance & Guaranty Co., 155 Md. 514, 531, 142 A. 710 (1928).
[3]  Glazer acquired its right of subrogation on December 31, 1987, when it paid the debt, rather than on December 9, 1987, when it had made only a promise to pay the debt. The right of subrogation does not arise until a debt has actually been paid. See Harford Bank v. Hopper's Estate, 169 Md. 314, 324, 181 A. 751 (1935); 10 S. Williston, A Treatise on the Law of Contracts § 1269 at 857 (W. Jaeger 3d ed. 1967); 83 C.J.S. Subrogation § 11 (1953).
[4]  A guaranty of payment of rent is an absolute and not a conditional undertaking upon which the guarantor is liable immediately upon the default of the lessee without any attempt to collect from the lessee. See 49 Am.Jur.2d Landlord and Tenant § 662 (1970). A guarantor promises to perform if the principal does not. General Motors Acceptance v. Daniels, 303 Md. 254, 260, 492 A.2d 1306 (1985).
