If, before final judgment is rendered in the first action, the defendant in that action is adjudged trustee in the other and pays thereon the money demanded in the first action or any part of it, the fact shall be stated on the record of the first action and judgment therein shall be rendered for the costs due to the plaintiff and for such part of the debt or damages, if any, as remains due and unpaid.
14 M.R.S. § 2627