
130 Wis.2d 247 (1986)
387 N.W.2d 106
MARSHALL-WISCONSIN COMPANY, INC., a Wisconsin corporation, Plaintiff-Respondent,
v.
JUNEAU SQUARE CORPORATION, a Wisconsin corporation; Gertrude Berggren, a limited partner of Marshall-East, a limited partnership; Marshall-East, Inc., a Wisconsin corporation; Harold C. Smith, III, as Executor of the Estate of Harold C. Smith, Jr., and the Estate of Mildred B. Smith, Defendants-Appellants,
William T. COLLINGS; John J. Deutsch; Donald E. Stevens; Eugene N. Grotenhuis; W. George Bowring; Reinke & Schomann, Inc., a Wisconsin corporation; McDonald, Inc., a Wisconsin corporation; City of Milwaukee, a municipal corporation; Marshall-Michigan Co., Inc.; and unknown Heirs or Devisees of Charles Cochrane, Edward Cochrane, and John A. Cochrane, Defendants.
MARSHALL-WISCONSIN COMPANY, INC., a Wisconsin corporation, Plaintiff-Respondent,
v.
JUNEAU SQUARE CORPORATION, a Wisconsin corporation; Tennie M. Conway, an individual; Harold C. Smith, III, individually and as Executor of the Estate of Harold C. Smith, Jr., and the Estate of Mildred B. Smith, Defendants-Appellants,
William T. COLLINGS; John J. Deutsch; Donald E. Stevens; Eugene N. Grotenhuis; W. George Bowring; Reinke & Schomann, Inc., a Wisconsin corporation; McDonald, Inc., a Wisconsin corporation; City of Milwaukee, a municipal corporation; and Marshall-Michigan Co., Inc., Defendants.
MARSHALL-WISCONSIN COMPANY, INC., a Wisconsin corporation, Plaintiff-Respondent,
v.
JUNEAU SQUARE CORPORATION, a Wisconsin corporation, William T. Collings; John J. Deutsch; Donald E. Stevens; Eugene N. Grotenhuis; W. George Bowring; Reinke & Schomann, Inc., a Wisconsin corporation; Marshall-East, Inc., a Wisconsin corporation; Gertrude H. Berggren; Estate of Harold C. Smith, Jr.; Estate of Mildred B. Smith and Marshall-Michigan Company, Inc., Defendants-Appellants.[]
Nos. 83-491, 83-1632, 85-0830.
Court of Appeals of Wisconsin.
Submitted on briefs January 3, 1986.
Decided March 14, 1986.
*250 For the plaintiff-respondent the cause was submitted on the briefs of Foley & Lardner by James O. Huber, Mark F. Foley, and Nancy J. Kopp, of Milwaukee.
For the defendants-appellants the cause was submitted on the briefs of George P. Kersten and Ann L. *251 Muchin, with Kersten & McKinnon of counsel, of Milwaukee.
Before Moser, P.J., Sullivan and Brown, JJ.
MOSER, P.J.
Juneau Square Corporation and others (collectively, Juneau Square) appeal three separate judgments of foreclosure upon the mortgages on three separate properties. Because the events giving rise to the foreclosures were not part of the same transactions or occurrences giving rise to a prior federal antitrust claim, we affirm the trial courts' determinations that Marshall-Wisconsin Company, Inc. (Marshall-Wisconsin) was not required to bring the foreclosures as compulsory counterclaims in the prior federal suit. Although the trial courts abused their discretion in refusing to dismiss these cases for lack of prosecution, we uphold the foreclosure judgments on equitable grounds. We affirm the courts' rulings that res judicata precluded Juneau Square and its codefendants-appellants from raising certain alleged business torts by Marshall-Wisconsin as affirmative defenses. We affirm the courts' determinations that Juneau Square and the other defendants-appellants lacked standing to assert affirmative defenses based on Marshall-Wisconsin's alleged violation of federal banking laws. Finally, we reverse the courts' ruling that Marshall-Wisconsin need not have mitigated its damages by applying to the mortgage debts any income it received from operating the three parcels as parking lots. We therefore remand these consolidated cases for a new trial on the mitigation issue and order that they remain consolidated upon remand.[1]
*252 The long and convoluted history of this case and its background facts appear in three connected cases.[2] The pertinent facts of the foreclosure actions forming the subject of this appeal are summarized below. Other relevant facts appear in the body of this opinion.

FACTS
In 1960 Juneau Square, a developer of office buildings, began planning the construction of a high-rise office building. The Juneau Square project was to be a three-phase development of an entire block, beginning with Juneau Square South, followed by Juneau Square North, and finally by the largest wing, Juneau Square East.
To that end, Juneau Square acquired three parcels of property. The Menos parcel was acquired in 1969 when Juneau Square gave a promissory note to the owner, Ernest G. Menos, and took out a mortgage on the property. The Vartanian parcel was transferred to Tennie M. Conway in 1966 in exchange for a promissory note from Juneau Square and a mortgage from Conway. The Marshall Street parcel, so named because of its location on the former North Marshall Street, was acquired by Juneau Square in 1969 in exchange for a mortgage in favor of Northwestern Elevator and *253 David Asmus, two prospective equitable investors in the Juneau Square development project.
In 1972 and 1973, by means of transactions not relevant here, Marshall-Wisconsin was assigned the mortgages on all three parcels. Because Juneau Square was in default on each mortgage, Marshall-Wisconsin brought three suits to foreclose on the properties. On July 25, 1972, Marshall-Wisconsin sued to foreclose on the Menos parcel, and on August 31, 1973, Marshall-Wisconsin brought suit to foreclose on both the Vartanian and Marshall Street parcels. These are the cases now on appeal.
In the meantime, on September 22, 1972, Juneau Square and its investors commenced an antitrust action in the federal District Court for the Eastern District of Wisconsin, alleging that Marshall-Wisconsin, its parent corporation, First Wisconsin National Bank of Milwaukee (First Wisconsin), and others had conspired to restrain trade by engaging in a variety of tortious and fraudulent acts and practices to preclude Juneau Square's development of the Juneau Square block. After a verdict initially favorable to Juneau Square, a new trial was ordered resulting in dismissal of Juneau Square's complaint. That dismissal was affirmed by the Seventh Circuit Court of Appeals. In 1977, Juneau Square then sued First Wisconsin in state court for various alleged business torts. Summary judgment was granted for First Wisconsin, and this court affirmed. Finally, in 1980, the United States Supreme Court denied certiorari in the federal action.
In 1981, after various delays and postponements more fully documented below, the three foreclosure cases were finally revived. The cases were scheduled for trial in the summer and fall of 1982. Juneau Square *254 sought to raise, as an affirmative defense to the foreclosures, Marshall-Wisconsin's and First Wisconsin's wrongful acts that had been the subject of the federal antitrust suit. In the Marshall Street case, Judge Holz granted Marshall-Wisconsin's motion to strike the affirmative defenses and held that the prior federal suit was res judicata. Judge Holz also denied Juneau Square's motion to dismiss premised on the ground that the foreclosure actions were compulsory counterclaims in the federal action. In the Menos action, Juneau Square sought leave to amend its answer to expand upon its affirmative defenses. Judge Jackson denied that motion. In the Vartanian case, Juneau Square's motion to raise the same affirmative defenses was denied by Judge O'Connell.
The trial courts also denied all of Juneau Square's other motions. This appeal followed. We ordered the cases consolidated for appeal pursuant to sec. 809.10(3), Stats.
COMPULSORY COUNTERCLAIMS
Juneau Square first argues that the trial courts should have dismissed the foreclosure actions because the foreclosures should have been brought as compulsory counterclaims in the federal antitrust action under Fed. R. Civ. P. 13(a).[3] Marshall-Wisconsin counters *255 that the Vartanian and Marshall Street foreclosure causes of action did not mature until after the federal suit was filed and thus could not be pled as federal counterclaims. Marshall-Wisconsin also argues that none of the foreclosures arose out of the same transactions or occurrences that formed the basis of the federal suit so as to require them to be brought as compulsory counterclaims.
In the Marshall Street case, Judge Holz denied Juneau Square's motion to dismiss pursuant to Fed. R. Civ. P. 13(a). Judge Holz determined that the foreclosures did not arise out of the same transactions or occurrences that were the subject of the federal action because the notes and mortgages Marshall-Wisconsin was suing upon arose prior to and independent of any of Marshall-Wisconsin's allegedly wrongful activities. Judge Holz found that therefore the foreclosures did not have to be pleaded as compulsory counterclaims in the federal action. Judges Jackson and O'Connell concurred in his reasoning.
Rule 13(a) requires that a counterclaim be pled "if it arises out of the transaction or occurrence that is the subject matter of the opposing party's claim."Counterclaims that are compulsory under Rule 13(a) are lost if not raised at the proper time.[4] In general, there are *256 four tests by which a court can determine whether a counterclaim is compulsory:
(1) Are the issues of fact and law raised by the claim and counterclaim largely the same?
(2) Would res judicata bar a subsequent suit on the defendant's claim absent the compulsory counterclaim rule?
(3) Will substantially the same evidence support or refute the plaintiff's claim as well as the defendant's counterclaim? and,
(4) Is there any logical relationship between the claim and counterclaim?[5]
The Seventh Circuit Court of Appeals has adopted the "logical relationship" test.[6] One district court in this circuit has stated that "a counterclaim is logically related to the opposing party's claim where separate trials on each of their respective claims would involve a substantial duplication of effort and time by the parties and the courts."[7] The "logical relationship" test is to be applied flexibly to further the policies of the federal rules in general and Rule 13(a) in particular.[8]
The principal purpose of making certain counterclaims compulsory is judicial economy.[9] Rule 13(a) *257 seeks to avoid multiple trials[10] and to achieve resolution in a single lawsuit of all disputes arising out of common matters.[11] Absent a relationship between a claim and a counterclaim which would further the purposes of Rule 13(a), courts should decline to apply that rule mechanically.[12]
The trial courts here determined that the state foreclosure claims and the prior federal antitrust action did not meet the first three test of Rule 13(a) and only met the "logical relationship" test because that test "is all things to all men."[13] The application of a statute to undisputed facts is a question of law which an appellate court may independently determine.[14] Nevertheless, we agree with the trial courts' conclusions that Marshall-Wisconsin's foreclosure claims were not compulsory counterclaims under Rule 13(a).
To have required Marshall-Wisconsin to raise its foreclosure actions as compulsory counterclaims in the federal antitrust action would not have promoted judicial economy. As noted by the Seventh Circuit Court of Appeals, federal antitrust suits are commonly long and complex actions.[15] The two federal trials in this matter ran a total of seven and one-half months. As the Seventh Circuit stated,

*258 [A] federal antitrust suit is typically unwieldy. ... To encumber it with a counterclaim based on a completely unrelated [state] statute would not promote judicial economy. ... [The trial of the state law count] will be neither streamlined nor expedited if it is made the tail on a large multi-party antitrust donkey.... [W]e are [also] reluctant to adopt a broad reading of Rule 13(a) in a case where deeming a counterclaim compulsory would bring into federal court a dispute over state law that could not ... get into it any other way.[16]
The federal trials here were long and complex enough without the addition of the foreclosure issues. In fact, complexity was one of the reasons why a new federal trial was ordered. Judicial economy almost mandated that the antitrust and foreclosure matters be tried separately. We therefore hold that because the state foreclosure actions were not compulsory counterclaims in the federal antitrust suit, the trial courts correctly declined to dismiss the foreclosures pursuant to Rule 13(a).[17]

FAILURE TO PROSECUTE
Juneau Square next claims that the three foreclosure suits should have been dismissed under sec. 805.03, Stats., for Marshall-Wisconsin's failure to prosecute them. Marshall-Wisconsin argues that going forward with the foreclosures before the complex antitrust *259 issues were fully resolved made no sense, and that, at any rate, Juneau Square concurred in the delays and cannot now be heard to complain. Marshall-Wisconsin also contends that Juneau Square's trial court motions to dismiss for failure to prosecute were untimely.
As stated above, Marshall-Wisconsin became assignee of the mortgages on the three parcels during 1972 and 1973. The foreclosure action on the Menos parcel was filed on July 25, 1972; the foreclosure suits on the Vartanian and Marshall Street parcels were both filed on August 31, 1973.
In the Menos case, the action proceeded for a time after it was filed. For instance, various notices of retainer were filed, interrogatories were filed and answered, and a request was made to substitute the judge. The record indicates that from November, 1972, to September, 1975, nothing occurred. A pretrial order was issued on September 17, 1975, but apparently nothing ever came of it. The action was finally resumed on June 23, 1981, when Judge Jackson issued a scheduling order. The matter then proceeded to trial on June 23-30, 1982.
A similar course of events took place in both the Vartanian and Marshall Street cases. In Vartanian, prosecution of the action proceeded until October 5, 1973. On that date Marshall-East, Inc. (Marshall-East), a limited partner of Juneau Square and one of the codefendants here, filed a demurrer to the complaint. The record shows that no other activity occurred in the case until January 19, 1982, when Juneau Square filed a motion for summary judgment. The Vartanian case came to trial on November 9 and 10, 1982.
*260 In the Marshall Street case, the record indicates that the case proceeded until March 20, 1974, when a notice of retainer was filed by one of the parties and Juneau Square answered. Nothing occurred until March 5, 1979, when Marshall-East filed its answer. Another lapse occurred until a pretrial order was filed on August 10, 1981. The Marshall Street action then proceeded to trial on September 17, 1982.
Section 805.03, Stats., states that: "For failure of any claimant to prosecute ... the court in which the action is pending may make such orders in regard to the failure as are just, including but not limited to orders authorized under s. 804.12(2)(a)." Orders authorized by sec. 804.12(2)(a), Stats., include a dismissal of the action on the merits.[18]
A motion to dismiss for lack of prosecution is addressed to the trial court's sound discretion.[19] The trial court's decision will be reversed only where it is clearly shown that there was an abuse of discretion.[20] We will set aside a discretionary order when it is apparent that the court arbitrarily exercised its discretion.[21] A discretionary determination must be the product of a rational mental process by which the facts of record and the law relied upon are stated and are considered together to achieve a reasoned and reasonable determination.[22]*261 If a trial court's decision is not supported by reasons cited in the record, it is not a rational determination.[23] Where the trial court fails to set forth its reasoning in exercising its discretion, we should independently review the record to determine whether it provides a basis for the trial court's exercise of discretion.[24]
All three trial courts here denied Juneau Square's motions to dismiss for failure to prosecute. The courts, however, failed to state on the record their reasons for denying the motions. The courts thus abused their discretion.
We have reviewed the record, and the facts therein do not support the trial courts' decisions. In each case Marshall-Wisconsin clearly abdicated its responsibility as plaintiff to take affirmative action to prosecute the cases.[25] Our supreme court has stated that longstanding legislative, judicial and public policies require that actions not be permitted to slumber indefinitely,[26] as was the case here. Each of the trial courts here should have dismissed the case before it for lack of prosecution.[27]
*262 Although the trial courts abused their discretion in failing to dismiss the cases for lack of prosecution, we do not remand the cases for dismissal of the foreclosure complaints. A reviewing court has the power to fashion a remedy appropriate to the exigencies and needs of the case before it, especially in equity cases.[28] We therefore uphold all three foreclosures.
Foreclosure upon a mortgage is an equitable remedy.[29] The trial court should balance the equities between *263 the parties to determine whether foreclosure is merited.[30] Here each trial court determined that equity mandated foreclosure. We agree.
We agree with the trial courts' conclusions that foreclosure of the mortgages should stand. We fashion our own remedy here because of the extreme passage of time involved in these cases. We hold that it would be fruitless to reverse the judgments at this time because upon reversal Marshall-Wisconsin would again obtain foreclosure judgments upon the parcels. Reversal thus would result in injustice to both sides of the conflict because of the duplication of effort and greater costs involved in the litigation that would surely follow. We thus affirm the foreclosure judgments.

RES JUDICATA
Juneau Square next contends that the trial courts erred in ruling that Juneau Square and the other defendants-appellants were barred by res judicata from litigating certain affirmative defenses wet forth in their amended answers. In their amended answers in the three cases, Juneau Square and its codefendantsappellants sought to raise as affirmative defenses Marshall-Wisconsin's and First Wisconsin's "tortious, fraudulent and inequitable acts." The answers then set forth the basic facts of the parties' business dealings from late 1969 to the present by appending a copy of Juneau Square's amended complaint in the federal district court. Those facts also formed the basis of Juneau *264 Square's federal antitrust claim and its state court action.
In the Marshall Street case, Judge Holz ruled that because of both the federal and state court judgments, res judicata barred relitigation of Juneau Square's defense. The judge stated that it was immaterial that the operative facts were asserted as defensive matters. In a later ruling on Marshall-East's request to amend its answer on the ground that it was not a party to the federal action, Judge Holz ruled that laches barred Marshall-East's request because it waited nine years to assert the defenses. The judges in the Vartanian and Menos cases also ruled that res judicata barred relitigation of Juneau Square's affirmative defense.
Whether the doctrine of res judicata applies is a question of law.[31] Appellate courts need not defer to trial courts on questions of law.[32]
Our analysis of the res judicata issue presents us with three questions:
(1) Are the business tort defenses Juneau Square wishes to raise here part of the same cause of action for res judicata purposes as the federal antitrust action?
(2) Does res judicata bar relitigation of a claim that is brought as a defense in a later action?
(3) Does res judicatabar all appellants from relitigating the business torts defense?
We address these questions seriatim. 1. Same Cause of Action
*265 Juneau Square initially argues that the trial courts erred in using res judicata to bar its defenses on the basis that the antitrust suit and the foreclosure actions were not the same cause of action. It then contends that the courts should have applied collateral estoppel, which Juneau Square asserts would not bar its defenses. This position fails on further analysis.
The doctrine of res judicata states that a final judgment is conclusive in all subsequent actions between the same parties as to all matters which were litigated in the former proceedings.[33] A valid and final judgment on the merits in favor of the defendant bars another action by the plaintiff on the same cause of action.[34]
What constitutes a "cause of action" for res judicata purposes has been a matter of some confusion. The Wisconsin rule now treats all claims arising out of one transaction or factual situation as being part of a single cause of action and requires them all to be litigated together.[35] Thus, for res judicata purposes, a basic factual situation generally gives rise to only one cause of action, no matter how many different theories of relief *266 may apply.[36] A final judgment on the merits is then res judicata as to all matters, legal and/or equitable, in support or defense of that cause of action.[37]
The cause of action under scrutiny, then, is the fact situation on which Juneau Square's antitrust claim was based. This court determined, in a prior appeal involving these parties, that all of Juneau Square's asserted state claims arose out of the same conduct by First Wisconsin and Marshall-Wisconsin that was alleged in the federal suit.[38] Those state claims are identical to the business tort defense at issue here. That holding is binding on us and on Juneau Square. Judge Holz correctly held that it makes no difference for res judicata purposes whether a "claim" is asserted affirmatively or defensively.[39] Because Juneau Square's business tort defense and federal antitrust claim are the same cause of action, Juneau Square cannot relitigate its defense.[40]
*267 2. Relitigation of Claim Brought as Defense
Juneau Square next asserts that res judicata does not bar relitigation of a claim brought as a defense. It argues that even if its business tort defense and antitrust claim are the same cause of action, it can still assert the business tort claim as a defense, because res judicata only bars the relitigation by a plaintiff of a claim brought affirmatively. Juneau Square is mistaken.
Nothing in the doctrine of res judicata restricts its preclusive effect to a subsequent claim brought affirmatively. Our conclusion is supported by the Restatement (Second) of Judgments § 25, comment i (4) (1981), which states that an "'equitable' ground for a claim withheld from an action cannot be used as a defense in a later action." This principle is a corollary of the rule that a judgment against the plaintiff in an action precludes the plaintiff from maintaining a second action on the claim for different relief. We see no reason why Juneau Square, having failed to litigate its fraud and business tort claims in federal court, should now be allowed to invoke them defensively against Marshall-Wisconsin. As stated above, this court previously determined that Juneau Square's state claims were part of the same cause of action as its federal claim. As such, the state claims should have been litigated in federal court. We hold that the trial courts were correct in barring Juneau Square from litigating its defenses on res judicata grounds.
*268 3. Identity of Parties
Juneau Square next argues that this court should allow some of its codefendants-appellants in the foreclosure cases to litigate the business tort defense because certain of them were not party to the federal action. Juneau Square argues that since some of its codefendants-appellants were dismissed from the federal trial for lack of standing, they did not have an opportunity to litigate any claim. We disagree.
In the Vartanian case, Judge O'Connell denied the estates of Harold C. Smith, Jr., and Mildred B. Smith (the Smith Estates) the chance to litigate the business tort defenses. Judge O'Connell did not cite any reasons for his decision. However, we hold that his decision was proper on res judicata grounds.
The Smith Estates initially were parties to the federal court action, but were dismissed for lack of standing because they lacked antitrust injury. In effect, they were dismissed because they had no claims to assert. We note that in a prior appeal in this matter, we determined that the judgment dismissing the Smiths constituted a judgment on the merits, and that the Smiths were thereby precluded under res judicata from bringing their state law claims.[41] Here the Smith Estates are in privy with the Smiths, and it makes no difference that the Smith Estates bring their state law claims as defenses. The Smith Estates are thus collaterally estopped from arguing that they are not bound by the federal court's dismissal from asserting the business tort defense.
Judges Holz and Jackson in the Marshall Street and Menos cases, respectively, also denied Marshall-East *269 the opportunity to litigate the business tort defense. Judge Holz reasoned that Marshall-East knew about its defense for nine years and could not now seek to amend its answer to include it. Judge Jackson denied without comment Marshall-East's request to amend. We agree with these two judges' decisions, but for different reasons.[42]
In a document dated February 28, 1974, Marshall-East assigned all of its claims against First Wisconsin and Marshall-Wisconsin to Jack D. Moertl (Moertl) and John F. Spoden (Spoden), in exchange for a portion of any proceeds. Moertl and Spoden were dismissed from the federal action for lack of standing. Because such a judgment was on the merits and would preclude Moertl and Spoden from bringing any state claims, Marshall-East's right to assert the business tort defense is similarly extinguished.[43]
STANDING TO ASSERT BANKING LAW AFFIRMATIVE DEFENSE
Juneau Square next asserts that it has standing to assert an affirmative defense based on the federal *270 banking laws.[44] Juneau Square argues that Marshall-Wisconsin should be precluded from foreclosing on the three mortgages because foreclosure would allow Marshall-Wisconsin to illegally acquire land.
In a case involving a similar challenge to a bank's acquisition of a lease option, an Illinois appellate court affirmed the dismissal of an affirmative defense based on the federal banking laws.[45] The court there held that actions under 12 U.S.C. § 29, part of the National Bank Act, can be initiated only by the Comptroller of Currency of the United States and cannot constitute the basis for a claim for relief.[46] The court stated that the alleged violation of a federal statute resulting in harm to someone does not necessarily give rise to a private *271 cause of action in that person's favor.[47] Only if the claimant meets four specific factors does such a private remedy arise.[48] The threshold question is whether the statute was enacted for the benefit of a special class of which the claimant is a member.[49]
The Illinois court went on to determine that the limitation no the power of national banks contained in 12 U.S.C. § 29 to invest in real estate was intended to protect bank depositors and stockholders from risky investments.[50] Because the defendants there did not purport to base standing upon their identity as members of either of those two classes, the Illinois court refused to permit them to assert a private action under 12 U.S.C. § 29.
In the instant case, neither Juneau Square nor any of its codefendants assert that they are bank depositors or stockholders warranting the protection of the federal banking laws. That being the case, they do not have standing to assert their defense based on the banking laws, and cannot attempt to enforce those laws in lieu of the government. We thus affirm the trial *272 courts' dismissals of Juneau Square's banking law affirmative defense.

SET-OFF OF PARKING LOT INCOME
Finally, Juneau Square asserts that the trial court erred in denying its request for an accounting or to set off against its mortgage debts Marshall-Wisconsin's income from operating the properties as parking lots under an alleged agreement. Juneau Square raised this issue in the Menos foreclosure trial, in which Moertl was allowed to testify, over Marshall-Wisconsin's objections, that Juneau Square and Marshall-Wisconsin made an agreement to lease the properties for five years, to operate them as parking lots, and to apply the parking lot revenue towards the mortgage debts. The record reflects that the properties were to be released at a rate of $3,000 per year and that the lessee was to pay the real estate taxes. Moertl further testified that after signing the agreement Marshall-Wisconsin reneged. The record does indicate that the properties were all used for parking facilities, but it is not possible to determine from the record the amount of the parking lot income and expenses. Judge Jackson took under advisement Marshall-Wisconsin's motion in limine to exclude Moertl's testimony concerning the set-off claims from parking lot revenue. At the close of the testimony, Juneau Square moved to amend its pleadings to conform to the evidence, and Marshall-Wisconsin moved to strike all testimony as to the agreement or the parking lot income. Judge Jackson did not decide these issues until two years after trial. The judge then struck all testimony regarding the alleged set-off, denied Juneau Square's motion *273 to amend its answer, and refused to allow Juneau Square to apply the parking lot income to the mortgage debts. Judge Jackson gave no reasons for his decisions.
In the Marshall Street case, Judge Holz refused to allow Juneau Square to amend its answer to include the set-off issue and prevented Juneau Square from introducing any evidence of parking lot income. Judge Holz stated that this action was approximately ten years old, that Juneau Square had known of these issues in 1974 and 1975 and that raising these issues six years later was unreasonable. He therefore declined to hear any testimony regarding accounting or setting off earnings against the mortgage monies due.
In the Vartanian foreclosure action, Judge O'Connell ruled, in response to Marshall-Wisconsin's motion in limine, that Juneau Square would not be allowed to admit accounting or set-off testimony on the basis of res judicata.
It follows that all three foreclosure actions went to judgment without an accounting or set-off of any parking lot revenue against Juneau Square's mortgage obligations. As stated earlier, mortgage foreclosure actions are equitable remedies[51] and appellate courts have the power to fashion such remedies as are needed for each case.[52] In foreclosure actions where the property produces income, it is thoroughly established that an equity court can appoint a receiver to take possession of and manage the mortgaged premises and to apply monies received from such management to the *274 mortgage indebtedness.[53] This is done to prevent waste of the mortgaged premises.[54] Likewise, a mortgagee in peaceable possession of the mortgaged premises can collect rents or enter into lease contracts to avoid waste.[55] Rents collected by a mortgagee in lawful possession of the mortgaged premises must be applied against the mortgage debt.[56]
Equity jurisprudence does not require the mortgagor in a foreclosure action to plead or raise an affirmative defense of accounting or set-off, as the trial courts required in these cases. The mortgagee in foreclosing upon the mortgage is only entitled to the amounts found in the mortgage document. All the mortgages in this case recite that in the event of default the mortgagee, Marshall-Wisconsin, is entitled to foreclose upon the premises, have a sheriff's sale and receive the amount of the debt with interest and costs of the foreclosure action. We therefore hold that any income produced by operating these parcels as parking lots during the pendency of these foreclosure actions is to be accounted for and deducted from the mortgage debt before a deficiency is determined. In its calculation the trial court must also consider Marshall-Wisconsin's *275 costs of operating the parking lot, including the real estate taxes paid, and its expenses as an informal receiver. We thus remand this matter to the trial court for consideration of these issues. In all other respects the judgments are affirmed.
By the Court.Judgments affirmed in part, reversed in part and causes remanded as consolidated.
NOTES
[]  Petition to review granted. ABRAHAMSON, J., took no part.
[1]  We order this case to remain consolidated upon remand to the trial court pursuant to our supervisory authority over all actions and proceedings in this district's trial courts. See Wis. Coast. art. VII, § 5(3).
[2]  See Juneau Square Corp. v. First Wisconsin Nat'l Bank, 435 F.Supp. 1307, 1309-16 (E.D. Wis. 1977); Juneau Square Corp. v. First Wisconsin Nat'l Bank, 624 F.2d 798, 801-06 (7th Cir. 1980), cert. denied, 449 U.S. 1013 (1981); and Juneau Square Corp. v. First Wisconsin Nat'l Bank, 122 Wis. 2d 673, 677-81, 364 N.W.2d 164, 166-68 (Ct.App. 1985).
[3]  Fed. R. Civ. P. 13(a) reads as follows:

A pleading shall state as a counterclaim any claim which at the time of serving the pleading the pleader has against any opposing party, if it arises out of the transaction or occurrence that is the subject matter of the opposing party's claim and does not require for its adjudication the presence of third parties of whom the court cannot acquire jurisdiction, But the pleader need not state the claim if (1) at the time the action was commenced the claim was the subject of another pending action, or (2) the opposing party brought suit upon his claim by attachment or other process by which the court did not acquire jurisdiction to render a personal judgment on that claim, and the pleader is not stating any counterclaim under this Rule 13. [Emphasis added.]
[4]  Baker v. Gold Seal Liquors, Inc., 417 U.S. 467, 469 n.1 (1974).
[5]  6 C. Wright and A. Miller, Federal Practice and Procedure § 1410 at 42.
[6]  Valencia v. Anderson Bros. Ford, 617 F.2d 1278, 1291 (7th Cir. 1980), rev'd on other grounds, 452 U.S. 205 (1981).
[7]  Super Prods. Corp. v. D P Way Corp., 75 F.R.D. 659, 659 (E.D. Wis. 1977) (citation omitted).
[8]  Valencia, supra note 6, 617 F.2d at 1291 (citation omitted).
[9]  By-Prod Corp. v. Armen-Berry Co., 668 F.2d 956, 960 (7th Cir. 1982).
[10]  Id.
[11]  Warshawsky & Co. v. Arcata Nat'l Corp., 552 F.2d 1257, 1261 (7th Cir. 1977).
[12]  Valencia, supra note 6, 617 F.2d at 1292.
[13]  See 6 C. Wright and A. Miller, supra note 5, § 1410 at 46-47.
[14]  Manor v. Hanson, 123 Wis. 2d 524, 533, 368 N.W.2d 41, 45 (1985).
[15]  By-Prod Corp., supra note 9, at 960.
[16]  Id. at 960-61 (emphasis added).
[17]  We, like the trial court, thus decline to discuss Marshall-Wisconsin's argument that the Vartanian and Marshall Street foreclosures were noncompulsory counterclaims because they allegedly matured after the federal antitrust action was filed.
[18]  See sec. 804.12(2)(a)3., Stats.
[19]  Zeis v. Fruehauf Corp., 56 Wis. 2d 486, 489, 202 N.W.2d 225, 226 (1972) (citations omitted).
[20]  Id.
[21]  Carlson Heating, Inc. v. Onchuck, 104 Wis. 2d 175, 181, 311 N.W.2d 673, 676 (Ct.App. 1981).
[22]  Hartung v. Hartung, 102 Wis. 2d 58, 66, 306 N.W.2d 16, 20-21 (1981).
[23]  See id. at 68, 306 N.W.2d at 20.
[24]  State v. Pharr, 115 Wis. 2d 334, 343, 340 N.W.2d 498, 502 (1983).
[25]  See Zeis, supra note 19, at 490-91, 202 N.W.2d at 227.
[26]  Cukrowski v. Mount Sinai Hosp., Inc., 67 Wis. 2d 487, 500, 227 N.W.2d 95, 102 (1975), cert. denied, 423 U.S. 914 (citations omitted).
[27]  Marshall-Wisconsin makes two arguments ostensibly justifying its delay in prosecuting the foreclosures. It first contends that no action could be taken in the foreclosure cases while the parties were awaiting the outcome of the federal antitrust litigation. It asserts that such a delay was necessary because Juneau Square asserted as defenses in the foreclosure actions the same tortious acts that were the basis of its federal antitrust claim.

Marshall-Wisconsin's failure to prosecute the foreclosures is not excused by the pending federal antitrust suit. It failed to seek a stay or continuance of any kind in the foreclosure cases. Moreover, our supreme court has held that the fact that another action was pending involving the same parties did not excuse a plaintiff from prosecuting an action. Wisconsin Lumber & Supply Co. v. Dahl, 214 Wis. 137, 140-41, 252 N.W. 714, 716 (1934); Taylor v. State Highway Comm'n, 45 Wis. 2d 490, 496-97, 173 N.W.2d 707, 712 (1970). Nor does Juneau Square's alleged collusion in delaying the foreclosure proceedings excuse Marshall-Wisconsin from its duty to prosecute. See Lowe v. Ring, 151 Wis. 664, 665, 139 N.W. 429, 429 (1913).
Second, Marshall-Wisconsin incorrectly contends that Juneau Square untimely raised the sec. 805.03, Stats., issue. Section 805.03 does not require that a motion to dismiss for failure to prosecute be made at any particular time; it only requires that the action be pending. Thus, even in the Menos case where Juneau Square brought the sec. 805.03 motion two years after trial, Juneau Square's motions to dismiss were timely made.
[28]  Wisconsin's Envtl. Decade, Inc. v. Public Serv. Comm'n, 84 Wis. 2d 504, 534, 267 N.W.2d 609, 625 (1978).
[29]  Pleasure Time, Inc. v. Kuss, 78 Wis. 2d 373, 383, 254 N.W.2d 463, 468 (1977).
[30]  Id.
[31]  DePratt v. West Bend Mut. Ins. Co., 113 Wis. 2d 306, 310, 334 N.W.2d 883, 885 (1983) (footnote omitted).
[32]  Id. (footnote omitted).
[33]  Id. (footnote omitted). See Parklane Hosiery Co. v. Shore, 439 U.S. 322, 326 n.5 (1979).
[34]  DePratt, supra note 31, at 310, 334 N.W.2d at 885 (footnote omitted).
[35]  Juneau Square Corp., supra note 2, 122 Wis. 2d at 682, 364 N.W.2d at 169. See DePratt, supra note 31, at 311, 334 N.W.2d at 886 (quoting Restatement (Second) of Judgments § 24, comment a (1981)).
[36]  Juneau Square Corp., supra note 2, 122 Wis. 2d at 684, 364 N.W.2d at 170. See Harper Plastics, Inc. v. Amoco Chems. Corp., 657 F.2d 939, 944 (7th Cir. 1981) (in determining what is a "cause of action" for res judicata purposes, the Harper court looks to whether the right and duty and wrong complained of are the same in both actions).
[37]  Lambert v. Conrad, 536 F.2d 1183, 1185 (7th Cir. 1976) (citation omitted).
[38]  Juneau Square Corp., supra note 2, 122 Wis. 2d at 684, 364 N.W.2d at 170.
[39]  See our discussion below.
[40]  We disagree with Juneau Square's intimation that the federal district court's failure to instruct the jury as to Marshall-Wisconsin's and First Wisconsin's alleged business torts meant that the antitrust and business tort claims were not the same cause of action. Because the business tort claims were not pled in the federal case, the jury was not instructed on them. In addition, Juneau Square is estopped from making this argument because this court has already deemed it meritless. See Juneau Square Corp., supra note 2, 122 Wis. 2d at 684, 364 N.W.2d at 170.
[41]  Juneau Square Corp., supra note 2, 122 Wis. 2d at 686, 364 N.W.2d at 171.
[42]  See State v. Alles, 106 Wis. 2d 368, 391, 316 N.W.2d 378, 388 (1982) (we will affirm trial court where it reaches the correct result but for the wrong reasons).
[43]  We note that the remainder of Juneau Square's codefendants-appellants were not parties to the federal court action but were privies to it because they were equitable investors in Juneau Square or its limited partner, Marshall-East.
[44]  Juneau Square asserts that Marshall-Wisconsin acquired the three mortgages here in violation of 12 U.S.C. § 29, which reads:

A national banking association may purchase, hold, and convey real estate for the following purposes, and for no others:
First. Such as shall be necessary for its accommodation in the transaction of its business.
Second. Such as shall be mortgaged to it in good faith by way of security for debts previously contracted.
Third. Such as shall be conveyed to it in satisfaction of debts previously contracted in the course of its dealings.
Fourth. Such as it shall purchase at sales under judgments, decrees, or mortgages held by the association, or shall purchase to secure debts due to it.
But no such association shall hold the possession of any real estate under mortgage, or the title and possession of any real estate purchased to secure any debts due to it, for a longer period than five years.
[45]  Central Nat'l Bank v. Fleetwood Realty Corp., 441 N.E.2d 1244 (Ill. App. 1982).
[46]  Id. at 1250, 1251. See Kerfoot v. Farmers' & Merchants' Bank, 218 U.S. 281, 286 (1910) (conveyance of real estate to a bank for an allegedly illegal purpose is voidable by the government alone).
[47]  Central Nat'l Bank, supra note 45, at 1250.
[48]  Id. (citing Cort v. Ash, 422 U.S. 66, 78 (1975) (citations omitted) (four criteria for inferring a private remedy from a federal statute are (1) is plaintiff one of class for whose benefit statute was enacted; (2) is legislative intent either to create or deny a private remedy; (3) is implied remedy consistent with underlying purposes of legislative scheme; and (4) is cause of action one traditionally relegated to state law, so that it would be inappropriate to infer a federal remedy)).
[49]  Central Nat'l Bank, supra note 45, at 1250.
[50]  Id. at 1250-51, citing Colorado Nat'l Bank v. Bedford, 310 U.S. 41, 49 (1940).
[51]  See supra notes 29 and 30 and accompanying text.
[52]  See supra note 28 and accompanying text.
[53]  See Allen, Appointment of Receivers in Mortgage Foreclosure Actions, 16 Marq. L. Rev. 168, 179 (1931-32); see also 10 G. Thompson, Commentaries on the Modern Law of Real Property § 5157 at 119 (J. Grimes repl. vol. 1957).
[54]  First Nat'l Bank v. Clark & Lund Boat Co., 68 Wis. 2d 738, 741, 229 N.W.2d 221, 223 (1975); see Grether v. Nick, 193 Wis. 503, 508-09, 213 N.W. 304, 307 (1927); see also sec. 813.16, Stets.
[55]  See 9 G. Thompson, supra note 53, § 4831 at 754-55 (J. Grimes repl. vol. 1958); see also Schwartzburg v. Rahtjen, 227 Wis. 525, 536, 279 N.W. 19, 24 (1938).
[56]  Schwartzburg, supra note 55, at 536, 279 N.W. at 24.
