
457 So.2d 535 (1984)
BARNETT BANK OF JACKSONVILLE, N.A., Appellant,
v.
JACKSONVILLE NATIONAL BANK, a National Banking Association, Appellee.
No. AP-163.
District Court of Appeal of Florida, First District.
September 26, 1984.
Rehearing Denied November 1, 1984.
*536 Peter L. Dearing and Thomas F. Harkins, Jr., of Mahoney, Hadlow & Adams, Jacksonville, for appellant.
Smith & Hulsey, Jacksonville, for appellee.
ZEHMER, Judge.
Barnett Bank of Jacksonville (Barnett) appeals a final judgment for Jacksonville National Bank (JNB) resulting from Barnett's refusal to repay an erroneous $29,597 transfer from JNB to Barnett with instructions to deposit the sum to one of Barnett's customers. Finding that the trial court failed to correctly apply the applicable law, we reverse.
The events leading to this dispute began with a wire transfer of funds from a bank in the Netherlands to Citibank in New York with instructions that the funds be credited to the account of Perfecta, U.S.A., through one of Citibank's correspondant banks in Jacksonville. On June 22, 1979, Citibank transferred the funds to JNB, one of its correspondant banks, by crediting JNB's account with $29,597.21, with instructions that JNB pay these funds to Barnett for deposit to Perfecta's account at Barnett. At this time, Barnett had no account directly with JNB, nor did Perfecta have an account with JNB. Several days after the transfer, in response to a request from a Barnett officer, an employee of JNB promptly transferred the funds to Barnett through the Federal Reserve Bank, and Barnett credited Perfecta's general checking account with the full amount of the transfer. The funds were actually placed in Barnett's own operating account so that as of June 29, 1979, the $29,597 was carried on Barnett's books of account as an asset of Barnett and a corresponding liability to Perfecta (as a depositor).
Approximately three weeks later, on July 20, 1979, Citibank, apparently unaware of JNB's transfer to Barnett, determined that it had mistakenly transferred Perfecta's funds to JNB rather than to Barnett and reversed the JNB transfer by reducing the balance of JNB's account with Citibank. At the same time, the funds were purportedly transferred by Citibank to Barnett with a mailgram confirming the deposit and containing the statement: "(WARNING POSSIBLE DUPLICATE)." But Citibank mistakenly credited two of Barnett's affiliates with this transfer, and not until *537 September 11, 1979, was this mistake corrected and the funds placed in Barnett's account with Citibank. This transfer was again carried as an asset of Barnett and as a liability to Perfecta on Barnett's books of account. Thus, as of September 11, Barnett had twice received payment of the $29,597 for Perfecta's account. Perfecta withdrew both deposits from Barnett shortly after they were made.
Approximately eight months later, on May 7, 1980, JNB discovered this error and realized it had lost $29,597, so Mr. Bernard of JNB called Mr. Fernandez, an officer of Barnett, to discuss correcting the error. Mr. Fernandez confirmed that the double payment had been received by Barnett for Perfecta's account, but said he would have to ask Perfecta to confirm the duplicate deposit, which he did. Perfecta initially denied any duplicate deposit. Approximately four months later, however, Perfecta conceded the duplicate deposit and provided Barnett with documentation confirming this fact. In the meantime, between May 7, 1980, and June 2, 1980, Perfecta's account balance with Barnett fluctuated considerably between an overdraft and substantial funds and on at least three occasions exceeded the amount necessary to reimburse JNB for the overpayment. Despite Barnett's actual knowledge of the duplicate deposits and despite JNB's claim, Barnett took no steps during this period of time to correct the mistake by freezing or setting off any funds in Perfecta's account, nor was Barnett requested to do so by JNB. The record reflects no formal request by JNB that Barnett return the $29,597 overpayment during this period. Perfecta subsequently went out of business and left no funds on deposit with Barnett. As a result, Barnett declined to pay JNB the claimed overpayment.
In April 1981, JNB initiated this suit seeking restitution from Barnett on a theory of unjust enrichment. Barnett denied that JNB was entitled to restitution from it and affirmatively alleged that it had not been unjustly enriched because the funds had been immediately credited to Perfecta's account and withdrawn by Perfecta; that a substantial change in position had occurred because Perfecta had gone out of business and no longer maintained any account with Barnett; and that JNB's claim was barred by laches. In response to Barnett's affirmative defenses, JNB alleged that Barnett had received actual knowledge of the "mistaken" transfer of $29,597 at a time when Perfecta "had more than that sum on deposit in its account" with Barnett and, therefore, Barnett could not rely on Perfecta's withdrawal of the funds as a defense.
At the nonjury trial, JNB urged, in addition to unjust enrichment and without amending the pleadings, that it should recover on a theory of "money had and received." Barnett contended, inter alia, that Perfecta initially denied that duplicate deposits had been made and that Barnett was not required to decide unilaterally that JNB was entitled to the funds in Perfecta's account. Barnett argued that it could not set off or hold funds credited to Perfecta's account to satisfy JNB's claim unless JNB had first obtained a court "order of garnishment or something like that, that would have been sufficient to attach those funds." The record is undisputed that JNB did not, prior to this suit, institute any legal proceeding to attach or freeze funds in Perfecta's account at Barnett or to procure a restraining order, injunction, or other appropriate process against Barnett at any time while Perfecta maintained funds in an active account at Barnett.
After the evidence was closed and counsel presented argument, the trial court perceived the issue in dispute, reduced to its barest essentials, to be whether Barnett was legally obligated or permitted to charge Perfecta's account with $29,597 after it gained actual knowledge of the duplicate deposit from JNB or whether Barnett had no legal right or obligation to so charge Perfecta's account without some intervening court order, such as a writ of garnishment or other legal process. The court entered final judgment for JNB upon the conclusion that:

*538 On May 7, 1980, JNB notified Barnett of the mistaken double payment. After that notification and after Barnett had actual knowledge that it had received a mistaken double payment of the $29,597.21 transfer, Perfecta had from time to time sufficient funds on deposit in its account with Barnett against which Barnett could have charged the amount of the mistaken $29,597.21 payment. The evidence therefore fails to sustain Barnett's defenses of an alleged change of position and laches.
Barnett asserts two points on this appeal: (1) JNB's action against Barnett is barred by section 658.61, Florida Statutes (1981); and (2) JNB has no right to recover from Barnett under common law theories of unjust enrichment or money had and received. Barnett primarily relies on the statute as controlling. Barnett recognizes that there is a split of authority in decisions from other jurisdictions decided prior to enactment of statutes similar to section 658.61 on whether a bank can be held liable for permitting withdrawals by depositors after receipt of notice of adverse claims to the funds by third parties, and contends that the proper common law rule is that discussed and applied in Gendler v. Sibley State Bank, 62 F. Supp. 805 (N.D. Iowa 1945), and similar cases.
JNB, on the other hand, argues that the evidence before the trial court fully supports its judgment for restitution, relying principally upon the decision in Union National Bank of Troy v. Sixth National Bank of New York, 43 N.Y. 452, 3 Am. Reptr. 718 (1869). JNB denies that its claim against Barnett is barred by section 658.61, Florida Statutes (1981), because (1) its claim against Barnett was not an adverse claim to a deposit within the meaning of the statute, and (2) Barnett waived any affirmative defense it might have had based on the statute.
We hold that section 658.61 governs the rights of the parties in the circumstances of this case and precludes the entry of a judgment for JNB. Section 658.61, formerly section 659.38, Florida Statutes (1979), was in effect at the time of the transactions involved in this case and provides as follows:
ADVERSE CLAIM TO BANK OR TRUST COMPANY DEPOSIT OR FIDUCIARY ACCOUNT.  Notice to any bank or trust company of an adverse claim to a deposit or fiduciary account standing on its books to the credit of any person shall not be effectual to cause the bank or trust company to recognize the adverse claimant unless the adverse claimant shall also either:
(1) Procure a restraining order, injunction, or other appropriate process against the bank or trust company from a court in a cause therein instituted by him wherein the person to whose credit the deposit or fiduciary account stands is made a party and served with process; or
(2) Execute to the bank or trust company, in form and with sureties acceptable to it, a bond indemnifying the bank or trust company from any and all liability, loss, damage, costs, and expenses for and on account of the payment of such adverse claim or the dishonor of the check or other order of the person to whose credit the deposit or fiduciary account stands on the books of the bank or trust company. (Emphasis added)
The statutory language makes it quite clear that whenever a third party asserts an adverse claim against funds on deposit to the account of one of a bank's depositors, such adverse claim will not be effectual and need not be honored by the bank until the third party either obtains a court order or executes an appropriate bond. The evident purpose of the statute is to relieve the bank from having to decide at its peril whether the adverse claim is valid and, further, to protect it against financial responsibility for making the wrong determination. Barnett was faced with that precise situation in this case.
JNB notified Barnett in May 1980 that it claimed a duplicate deposit had been mistakenly made to Perfecta's account at Barnett, that JNB had refunded the funds *539 so deposited to Citibank and that JNB was entitled to recover back those funds from Barnett. Since Barnett had properly credited the funds to Perfecta's account when received and Perfecta had promptly withdrawn the funds, JNB's claim against Barnett was necessarily asserted against other funds subsequently deposited to the account of Perfecta and then credited to that account by Barnett. Had Perfecta acknowledged the validity of JNB's claim when advised of it by Barnett, that claim would have ceased to be "adverse" within the meaning of the statute and Barnett would have become liable to JNB if JNB thereafter permitted Perfecta to draw down its account balance below the amount of such claim. But that was not the case here. Perfecta denied, when advised by Barnett, that duplicate deposits had been made, leaving JNB in the position of asserting against Barnett, in the language of the statute, "an adverse claim to a deposit ... standing on its books to the credit of any person" (Perfecta).
We reject the contention that JNB's claim is not against Perfecta's account, but only against Barnett for funds received by Barnett and placed in its general operating account. In no event would Barnett be liable to JNB if Perfecta had no funds on deposit with it, as JNB has implicitly, if not explicitly, recognized. Both JNB's claim and the trial court's order are predicated on the fact that after Barnett received notice of JNB's claim, Perfecta's account had balances exceeding the amount of JNB's claim on at least three occasions between May 7 and June 2, 1980. Since JNB's claim was "adverse" during this period, the claim would become effectual only upon JNB's compliance with the statute by procuring an appropriate court order pursuant to subparagraph (1) or by executing and delivering the appropriate bond pursuant to subparagraph (2). See, Griffin v. Gulf Life Insurance Co., 146 So.2d 901 (Fla. 1st DCA 1962). Since JNB did neither, Barnett was not obligated to protect JNB's interest.
JNB also contends that Barnett failed to allege any affirmative defense based on section 658.61 and did not bring that statute to the attention of the court below. The record clearly shows this to be true.[1] Therefore, JNB argues, Barnett has waived this affirmative defense and cannot now rely on it or make this argument for the first time on appeal.
We need not decide at this time whether section 658.61 imposes conditions precedent to any cause of action by JNB against Barnett that must be generally pleaded by the plaintiff under rule 1.120(c), Florida Rules of Civil Procedure,[2] or whether it amounts to matter constituting an avoidance or affirmative defense that must be pleaded by Barnett under rule 1.110(d), Florida Rules of Civil Procedure.[3] The record below sufficiently establishes that the issue, whether Barnett could be held liable to JNB in the absence of some court order or other process establishing JNB's right to funds in Perfecta's checking account with Barnett, was posed by the court and treated by the parties as within the issues being tried by the trial court. Rule 1.190(b), Fla.R.Civ.P.; Vanguard Construction Co. v. Lewis State Bank, 348 So.2d 72, 74 (Fla. 1st DCA 1977); Pike v. National Fidelity Life Insurance Co., 377 So.2d 973, 976 (Fla. 3d DCA 1979). The fact that Barnett presented this argument in terms of common law rules espoused in Gendler v. Sibley State Bank, supra, and similar cases does not preclude consideration of the statute for resolution of this appeal. Where a party intends to rely on a specific statute before the trial court, it is preferable to plead the specific statute, but it is not necessary to do so if the facts pleaded are sufficient to bring the case *540 within it since the court takes judicial cognizance of all public statutes. City of Lakeland v. Select Tenures, Inc., 129 Fla. 338, 176 So. 274, 277 (1937); Vance v. Indian Hammock & Riding Club, Ltd., 403 So.2d 1367, 1369 (Fla. 4th DCA 1981). Although section 658.61 was not called to the trial court's attention, nevertheless it must be followed by this court because the statute controls the matter before us. Bedenbaugh v. Adams, 88 So.2d 765 (Fla. 1956).
In view of our conclusion that the rights of the parties are governed by the applicable statute, it is unnecessary to consider the common law rules and numerous decisions relied upon by JNB and Barnett in support of their respective positions. The judgment is reversed, and the case is remanded with directions to enter judgment for Barnett.
REVERSED and REMANDED.
SMITH and BOOTH, JJ., concur.
NOTES
[1]  In fairness to the trial judge, had this statute been brought to his attention, no doubt a different result would have been reached.
[2]  No such averment was contained in JNB's complaint.
[3]  No pleading by Barnett specifically alleged the statute or any requirement of a court order or process as necessary to perfection of JNB's claim against Perfecta's account.
