
103 B.R. 240 (1989)
In re Basil N. SPIRTOS, M.D., Debtor.
Bankruptcy No. LA 87-10752-AA, Adv. No. LA 88-01202-AA.
United States Bankruptcy Court, C.D. California.
July 6, 1989.
*241 Stephen R. Rykoff, Los Angeles, Cal., for plaintiff/debtor.
George T. Mc Donnell, Los Angeles, Cal., Hal M. Marzell, for co-defendant Home Sav.
Steven R. Smith, Joseph L. Shalant, Los Angeles, Cal., for co-defendant Irene Moreno as Guardian Ad Litem.

OPINION RE: SUBROGEE'S ENTITLEMENT TO ATTORNEY FEES UNDER SECTION 506(b)
ALAN M. AHART, Bankruptcy Judge.

I

FACTS AND PROCEDURAL HISTORY
On April 12, 1983, Irene Moreno, as guardian ad litem for Raymond Guerena, obtained a medical malpractice judgment (the "Judgment") on special verdict against the Debtor, Basil N. Spirtos in the state court. On April 18, 1983, Moreno caused to record a certified copy of the Judgment with the Los Angeles County Recorder. In a separate proceeding from the one here, the Bankruptcy Court found that the recorded judgment did not create a valid lien.[1]
*242 The Debtor filed a timely appeal of the Judgment. On July 11, 1983, a personal undertaking on appeal was filed with the state court on behalf of the Debtor. On September 30, 1983, the Debtor obtained title to real property located at 1103 Rancho Road, Arcadia, California ("the Property") by grant deed recorded that date.
On November 1, 1983, the state court sustained an objection filed by Moreno regarding the sufficiency of the personal undertaking, and allowed the Debtor until December 13, 1983 to file a new undertaking. On December 5, 1983, Glacier General Assurance Company filed a personal and unsecured undertaking on appeal ("Glacier Undertaking") on behalf of the Debtor. Enforcement of the Judgment was thereby stayed pending the outcome of the appeal.[2]
On July 30, 1985, the Debtor executed a deed of trust (Deed of Trust") in favor of Home Savings & Loan Association ("Home Savings") against the Property as security for a note (the "Note") of even date in the amount of $500,000.[3] The Deed of Trust was recorded on August 28, 1985. At the time the Deed of Trust was recorded, Home Savings purchased a policy of title insurance ("the Policy") from First American Title Insurance Company ("First American"). The Policy specified that, inter alia, if Home Savings' lien on the Property became the subject of litigation, First American would provide a defense for Home Savings.[4] In return, First American would be subrogated to the rights and remedies of Home Savings.[5]
On November 12, 1985, a Montana state court appointed the Commissioner of Insurance for the State of Montana as liquidator of Glacier General Assurance Company and directed the Commissioner to liquidate Glacier's business in Montana and all other states and territories where it did business. Due to this somewhat unique turn of events, the benefits and protections afforded the Judgment by virtue of the undertaking, *243 were rendered, for all practical purposes, worthless.
On December 2, 1985, the Judgment was affirmed on appeal and the stay against enforcement of the Judgment ceased.[6] On July 21, 1986, Moreno caused to record a valid abstract of judgment with the Los Angeles County Recorder in the amount of $826,000, plus interest. The Debtor filed a Chapter 11 petition on May 28, 1987. Moreno timely filed a proof of claim in the chapter 11 proceeding for $826,576.78, plus interest at the rate of ten percent (10%) per annum from April 12, 1983. The case was eventually converted to chapter 7 on February 17, 1989.
On June 7, 1988, an order was entered allowing the Debtor to sell the Property free and clear of liens, with the liens attaching to the proceeds. The escrow on the sale of the Property closed on June 29, 1988 and the Debtor realized net proceeds of $1,201,722.80 ("the Proceeds").
On July 27, 1988, the Debtor filed a complaint to determine the nature, extent, and validity of liens ("the Complaint") that sought to determine the amount and priority of the claims of Home Savings, Moreno and other lienholders against the Property.
After the conclusion of discovery in this action, the parties stipulated that the lien created by Home Savings' Deed of Trust had priority over the secured claims of Moreno and the other lienors. Home Savings was paid $591,318.13, which constituted full payment of principal, accrued interest, late charges and reconveyance fees due under the Note and Deed of Trust. The parties also agreed that Home Savings would be entitled to the amount of its reasonable attorney fees fixed by the court.
During the course of these proceedings, Home Savings was represented by two sets of lawyers. Up to the filing of Home Savings' answer to the Complaint, Home Savings was represented by in-house counsel. The reasonable fees and charges for these services totalled $1,400. Based on the threat to Home Savings' lien posed by the Complaint, on October 7, 1988, Home Savings tendered its defense to the title insurer, First American. First American accepted the tender of defense and retained the law firm of Allen, Matkins, Leck, Gamble & Mallory ("Allen/Matkins") to represent Home Savings in the litigation. From and after October 12, 1988, Allen/Matkins acted for Home Savings in this matter and First American paid the fees and charges incurred for this representation. The court found the reasonable fees, costs, and charges so incurred totalled $16,752.94.
The parties did not disagree that Home Savings may recover the initial set of attorney fees and charges ($1,400) from the Proceeds presumably because Home Savings was clearly an oversecured creditor and entitled to said fees and charges pursuant to 11 U.S.C. section 506(b). The parties disagreed, however, as to whether the Allen/Matkin fees ($16,752.94) may be paid to First American from the Proceeds under section 506(b). It is this question that the court addresses.

II

ANALYSIS
A. The Subrogation Provision of Bankruptcy Code Section 509 Does Not Apply to These Facts Nor Is It An Exclusive Provision
Moreno contends that the only source of subrogation in bankruptcy is Bankruptcy Code section 509.[7] This section generally *244 permits subrogation for codebtors and entities that have pledged collateral to secure a creditor's claim.[8] Because First American is an insurer (but not a codebtor or pledgor), Moreno asserts that First American cannot be subrogated to Home Savings' position.
Moreno's argument fails both in equity and as an accurate statement of the law. Case law under the Code does not consider section 509 to be the exclusive source of subrogation rights.[9] The Ninth Circuit considered the doctrine of subrogation in a bankruptcy context in the case of In re New England Fish Co., 749 F.2d 1277 (9th Cir.1984). New England Fish described the elements necessary to maintain a claim for equitable subrogation[10] without ever mentioning section 509. See also In re Glade Springs, Inc., 826 F.2d 440 (6th Cir.1987) where the Sixth Circuit applied the doctrine of equitable subrogation to permit a bank that honored a letter of credit to be subrogated to the rights of the issuer in order to obtain secured status. Like the Ninth Circuit, the Sixth Circuit upheld a subrogation claim without alluding to section 509.[11]
It appears that section 509 is not even the exclusive subrogation provision under the Code itself. Section 507(d) provides that:
"An entity that is subrogated to the rights of a holder of a claim of a kind specified in subsection (a)(3), (a)(4), (a)(5), or (a)(6) of this section is not subrogated to the right of the holder of such claim to priority under such subsection."
Section 507(d) refers to subrogation without any reference to those specific subrogation rights set forth in section 509. If Congress meant for section 509 to be the only basis for subrogation under the Code, section 507(d) should read substantially as follows:
(d) An entity that is subrogated, pursuant to section 509 of this Code, to the rights of a holder of a claim . . . (underlined language not in original).
Section 507(d) refers to general subrogation rights that arise from the Code itself, state statutes, and the common law.[12] As section 507(d) neither defines subrogation, nor refers to section 509 of the Code for a definition, the logical conclusion is not to limit subrogation rights to those described in section 509. This conclusion is especially compelling where, as in this case, subrogation rights would otherwise be available.
*245 "The concept of equitable subrogation is a well recognized principle of EQUITY jurisprudence." In the Matter of Munzenrieder Corporation, 58 B.R. 228 (Bankr.M.D.Fla.1986); Prairie State Nat. Bank v. U.S., 164 U.S. 227, 17 S.Ct. 142, 41 L.Ed. 412 (1896). (emphasis added.) Equitable subrogation is a legal fiction[13] that compels the "ultimate payment of a debt by one who in justice, equity, and good conscience ought to pay it." Liberty Mutual Insurance Co. v. Borsari Tank Corp., 248 F.2d 277 (2nd Cir.1957); Pittsburgh-Westmoreland Coal Co. v. Kerr, 220 N.Y. 137, 115 N.E. 465 (1917). Equitable subrogation is a creation of equity, not statute and should not be confused with the subrogation rights specifically set forth in section 509.
In a pre-Code decision, the Ninth Circuit refused to limit the doctrine of subrogation to those enumerated sections of the California Civil Code that define subrogation generally,[14] stating: "This approach is supported by general equitable notions. It appears that subrogation is a doctrine broader in its reach than that prescribed in the Civil Code." In the Matter of Forester, 529 F.2d 310 (9th Cir.1976). This reasoning is equally applicable to the case at bar. This court adopts the reasoning of Forester and refuses to limit subrogation rights in bankruptcy to those described in section 509 of the Code.
Long standing equitable doctrines are not easily cast aside. If Congress meant to codify all subrogation rights into section 509 it would have done so explicitly. The legislative history of section 509 makes no mention of the common law doctrine of equitable subrogation. As a result, this court finds that the doctrine of equitable subrogation is separate and distinct from the subrogation rights afforded by section 509, and that section 509 is an additional, but not exclusive, remedy in bankruptcy.
B. The Rules Governing Subrogation Derive from California Law
First American's subrogation rights are determined according to California law. Simon v. United States, 756 F.2d 696 (9th Cir.1985); In re Forester, 529 F.2d 310 (9th Cir.1976); In re Flick, 75 B.R. 204 (Bankr. S.D.Cal.1987).[15] As a general rule of federal procedure, "[e]xcept in matters governed by the Federal Constitution or by acts of Congress, the law to be applied in any case is the law of the state." Erie v. Tompkins, 304 U.S. 64, 58 S.Ct. 817, 82 L.Ed. 1188 (1938). California law governs these proceedings inasmuch as the Property involved is located in California, the subject insurance policy was issued in California, and all events relating to this matter occurred in California.[16]
C. Under California Law, First American May Be Subrogated to the Position of Its Insured, Home Savings
In California, an insurer's claim for equitable subrogation must pass the following test:
(1) The insured has suffered a loss for which the party to be charged is liabie, either because the latter is a wrongdoer whose act or omission caused the loss or because he is legally responsible to the insured for the loss caused by the wrongdoer;
(2) the insurer, in whole or in part, has compensated the insured for the same loss for which the party to be charged is liable;
(3) the insured has an existing, assignable cause of action against the party to be charged, which action the insured could have asserted for his own benefit had he not been compensated for his loss by the insurer;
(4) the insurer has suffered damages caused by the act or omission upon which *246 the liability of the party to be charged depends;
(5) justice requires that the loss should be entirely shifted from the insurer to the party to be charged;
(6) the insurer's damages are in a stated sum, usually the amount it has paid to its insured, assuming the payment was not voluntary and was reasonable.[17]
The court finds all six elements are present in the instant case.
To satisfy the first element, First American must have suffered a loss chargeable to the Debtor or Moreno and the Debtor or Moreno must be a "wrongdoer" who caused the loss or who is legally responsible to First American for the loss caused by the "wrongdoer." First American has suffered a loss by virtue of paying the attorney fees and these fees are chargeable to the Debtor under the Deed of Trust. The Debtor is a "wrongdoer" who caused the loss because the Debtor filed the Complaint that triggered First American's obligation to protect Home Savings' lien.
Moreno may also be considered a "wrongdoer" because of the recalcitrant position Moreno initially adopted in this litigation. Notwithstanding the facts that recording the certified copy of the Judgment did not give Moreno a lien, that regardless of any such purported "lien" it would have been extinguished by virtue of the supersedeas bond filed on behalf of the Debtor, and that there was no evidence that Home Savings was not a bona fide lender without notice of the Moreno "lien," Moreno insisted that Home Savings' lien did not and should not have priority over the Moreno Judgment and/or "lien." This insistence was unreasonable as directed towards Home Savings and caused First American to incur significantly higher attorney fees.
The test's second element is present because First American defended Home Savings in the litigation (which is what the Debtor was obligated to do), and First American compensated Home Savings for the same loss for which the Debtor was liable.[18] The Debtor was responsible for Home Savings' attorney fees in defending Home Savings' in any dispute regarding the priority of the Deed of Trust or general state of title to the Property.[19] First American, while not "compensating" Home Savings for a loss in a strict sense, instead provided the needed services and paid the cost directly. The court sees no reason to require that Home Savings first pay Allen/Matkins and then obtain reimbursement for these fees against the Property as it would be entitled to pursuant to the Deed of Trust and section 506(b) of the Code. The fact that First American skipped a step by directly furnishing Home Savings with paid counsel does not mean that the second element of the test is not satisfied.
The test's third element is present because, if First American had not provided Home Savings with counsel, Home Savings would have retained and paid counsel on its own. Such action would have given rise to a perfectly legitimate section 506(b) claim as outlined above. Also, if Home Savings and First American had determined it necessary, Home Savings could have assigned the Note and Deed of Trust to First American. First American could even have unilaterally required such an assignment.[20] First American, on its own behalf, would then have acquired a section 506(b) claim. The policy behind allowing subrogation where an actual assignment could be accomplished is that an assignment needlessly increases transaction costs. In the interest of efficiency, subrogation should produce the same result as if an actual assignment had been made.[21]
*247 The test's fourth element is satisfied because the Debtor's filing of the Complaint against Home Savings made it impossible for the Debtor to defend Home Savings and necessary for First American to do so. The Debtor was obliged to compensate Home Savings for the cost of defending its priority under the terms of the Deed of Trust. First American paid Home Savings' costs instead, and consequently suffered damages. The Debtor is therefore liable for his failure to defend Home Savings. Moreno argued that the Debtor did not agree to be responsible for such fees to Home Savings' insurer; the Debtor only agreed to pay for Home Savings' fees. However, the fact that liability for such fees was contemplated by the Debtor indicates that it will work no injustice to hold him liable for same. Otherwise, it would be a windfall to the Debtor if the decision by Home Savings to obtain title insurance served to insulate the Debtor from his obligation to defend Home Savings and pay for Home Savings' attorney fees.
The test's fifth element essentially requires that the equities weigh in favor of First American. Justice requires that the Allen/Matkins fees be paid from the Proceeds because the amount of the fees will otherwise go to Moreno, whose dubious claim caused them to be incurred.
The test's sixth and final element is satisfied because the fees were paid by First American according to its obligation under the title insurance policy, and the reasonable stated sum of the fees was determined by this court. First American paid the Allen/Matkin fees pursuant to the title insurance policy, and therefore, First American was not a volunteer. Also, the court found that the fees' stated sum of $16,752.94 was reasonable.

D. Equitable Subrogation Will Prevent a Windfall and Discourage Frivolous Litigation

If the court were to deny equitable subrogation to First American, a windfall would accrue to Moreno. If the fees were disallowed, the amount of Proceeds would rise concomitantly and, since Moreno had the junior lien against the Property, her recovery would be increased accordingly. The court knows of no reason why Moreno, who in large measure caused First American to incur the attorney fees, should be spared from paying these fees. Moreover, if the fees were disallowed solely because they were paid by a title insurer, transaction costs would rise in relation to title insurance policies in that insurance companies would simply raise premiums accordingly, ultimately passing the cost along to the consumer. Furthermore, absent an assignment, if a junior lienholder or debtor knows that attorney fees incurred by a title insurance company will not be added to the secured claim of the senior lienholder, there will be more incentive for a junior lienholder or debtor to bring actions against senior lienholders in an attempt to extract a settlement once the plaintiff knows that the senior lienholder will tender its defense to the title insurance company. For these reasons alone, equitable subrogation is clearly warranted in the instant case.

E. Under Section 506(b), First American May Assert Its Claim for Attorney Fees

The next step is to apply Bankruptcy Code section 506(b) to the facts of this case. This section generally provides that oversecured creditors are entitled to postpetition interest and any reasonable charges, including attorney fees, provided for under the agreement under which the claim arose. In the instant case it is undisputed that Home Savings is oversecured. First American therefore becomes the holder of a claim, for its reasonable fees incurred, because it is subrogated to the rights of Home Savings. Section 506(b) mandates that the claim arise under an agreement that provides for the payment of such fees. As stated above, First American's attorney fees arose under the Deed of Trust.[22] As a result, First American is entitled to recover its reasonable attorney fees under the Deed of Trust and section 506(b).


*248 III

CONCLUSION
The subrogation provision of section 509 does not preclude an insurer from being subrogated to the rights and claims of its insured against a debtor. An insurer that assumes the defense of its insured's lien against the claims of a debtor or other creditors may be equitably subrogated to the rights of its insured, and may bring any claim against the debtor or other creditors that is available to the insured. Such right of subrogation must be determined on a case by case basis according to equitable principles. The section 506(b) claim of a subrogee to the position of an oversecured creditor/subrogor may be allowed only to the extent authorized by the underlying agreements and any applicable laws. Thus, First American shall receive reimbursement for the Allen/Matkins' fees in the reasonable amount of $16,752.94 as the holder of an allowed oversecured claim under section 506(b).
NOTES
[1]  The recorded Judgment did not identify the Debtor as a defendant in its caption. It did not list the last known address of the judgment debtor, the address at which the summons was served or mailed to the judgment debtor, the address of the judgment creditor, the social security number or driver's license number of the judgment debtor, or a statement indicating the fact that the driver's license number or the social security number of the judgment debtor were not known to the judgment creditor. Consequently, this court ruled that Moreno did not obtain a judgment lien pursuant to California Code of Civil Procedure sections 674 and 697.310.
[2]  The Glacier Undertaking was in the principal amount of $1,239,000 for the benefit of Raymond Guerena, pursuant to California Code of Civil Procedure Section 995.310. Glacier was, at the time of the posting of the Glacier Undertaking, a surety company authorized to act as a surety on bonds and undertakings in the State of California. The Debtor was not required to pledge any collateral to obtain this undertaking.
[3]  Paragraph nine of the Deed of Trust provided in part:

"9. Litigation. Trustor shall defend this trust and any action . . . purporting to affect the rights or powers of the Beneficiary, . . . and either Trustee or Beneficiary is hereby authorized, without obligation to do so, to commence, appear in or defend any such action, whether brought by or against Trustor, Beneficiary or Trustee, or with or without a suit, to exercise or enforce any other right, remedy or power available or conferred hereunder, . . . and Trustee or Beneficiary may appear or intervene in any action or proceeding and retain counsel therein and take such action therein as may be advised [and] may expend and advance such sums of money as either may be deemed necessary. Whether or not Trustor appears or defends, Trustor on demand shall pay all costs and expenses of Beneficiary and Trustee, . . . in any such action or proceeding in which Beneficiary or Trustee may appear by virtue of being made a party defendant or otherwise and irrespective of whether the interest of Beneficiary or Trustee in such property is directly questioned in such action. . . ."
[4]  Paragraph three of the Policy's conditions and stipulations provided:

"The Company, [First American], at its own cost and without undue delay shall provide for the defense of an insured in all litigation consisting of actions or proceedings commenced against such insured . . . to the extent that such litigation is founded upon an alleged defect, lien, encumbrance or other matter insured against by this policy."
[5]  Paragraph ten of the Policy's conditions and stipulations stated:

"The Company [First American] shall be subrogated to and be entitled to all rights and remedies which such insured claimant would have had against any person or property in respect to such claim had this policy not been issued, and if requested by the Company, such insured claimant shall transfer to the Company all rights and remedies against any person or property necessary in order to perfect such right of subrogation and shall permit the Company to use the name of insured claimant in any transaction or litigation involving such rights or remedies."
[6]  Unfortunately for Moreno, by this date the Debtor had few unencumbered assets remaining in his previously sizeable estate.
[7]  Section 509 provides:

"(a) Except as provided in subsection (b) or (c) of this section, an entity that is liable with the debtor on, or that has secured, a claim of a creditor against the debtor, and that pays such claim, is subrogated to the rights of such creditor to the extent of such payment.
(b) Such entity is not subrogated to the rights of such creditor to the extent that 
(1) a claim of such entity for reimbursement or contribution on account of such payment of such creditor's claim is 
(A) allowed under section 502 of this title;
(B) disallowed other than under section 502(e) of this title; or
(C) subordinated under section 510 of this title; or
(2) as between the debtor and such entity, such entity received the consideration for the claim held by such creditor.
(c) The court shall subordinate to the claim of a creditor and for the benefit of such creditor an allowed claim, by way of subrogation under this section, or for reimbursement or contribution of an entity that is liable with the debtor on, or that has secured, such creditor's claim, until such creditor's claim is paid in full, either through payments under this title or otherwise." 11 U.S.C. section 509. All subsequent references to the "Code" are to the Bankruptcy Code, Title 11 of the United States Code, unless otherwise specified.
[8]  HR Rep. No. 95-595, 95th Cong., 1st Sess. 358-59 (1977); S.Rep. No. 95-989, 95th Cong., 2d Sess. 73-74 (1978), U.S.Code Cong. & Admin. News 1978, pp. 5787, 5859, 5860, 5963, 6313, 6314.
[9]  "Section 509(a) establishes that co-debtors and sureties are subrogees, but it does not necessarily follow from this that others are not subrogees." In re Missionary Baptist Foundation of America, 667 F.2d 1244 (5th Cir.1982). (emphasis in original).
[10]  The elements were those required by the laws of the State of Washington.
[11]  See also In re Massetti, 95 B.R. 360 (Bankr.E. D.Pa.1989) rejecting section 509 as the sole authority for subrogation. "Subrogation is an equitable remedy. It is not an absolute right but one which depends on the equities and attending facts and circumstances of each case." See In re Commercial Reprographics, Inc., 95 B.R. 174 (Bankr.E.D.Cal.1988); and In the Matter of Munzenrieder Corporation, 58 B.R. 228 (Bankr. M.D.Fla.1986) that apply equitable subrogation without any reference to section 509; and In re Previs, 31 B.R. 208 (Bankr.W.D.Wash.1983) holds that equitable subrogation is a separate and distinct remedy from the relief afforded specifically by the Bankruptcy Code.
[12]  But see In re Missionary Baptist Foundation of America, 667 F.2d 1244 (5th Cir.1982) where the Fifth Circuit concluded that the restrictive definition of subrogation found in section 509 is to be applied to the meaning of subrogation as it is found in section 507(d) unless said application is "plainly at variance with the policy of the legislation."
[13]  Munzenrieder at 233.
[14]  California Civil Code Sections 2903 & 2904.
[15]  See also 26 U.S.C. section 6323(i)(2) for a useful example of a federal subrogation statute referring to state law for the rule of decision.
[16]  See In re Hutcherson, 50 B.R. 845, 849 (Bankr.E.D.Va.1985) applying Virginia state law under similar circumstances.
[17]  Patent Scaffolding Co. v. William Simpson Constr. Co., 256 Cal.App.2d 506, 64 Cal.Rptr. 187 (1967); Peters v. Travelers Ins. Co., 375 F.Supp. 1347 (C.D.Cal.1974).
[18]  See supra note 3.
[19]  See supra note 3.
[20]  See supra note 5.
[21]  This is the theory that the Missionary Baptist court essentially used, but in the reverse order. It went from subrogation to assignment because section 507(d) would not have allowed for recovery under a subrogation theory. This court rejects requiring an assignment by permitting subrogation.
[22]  See supra note 3.
