When such sum is paid to the secured party or deposited with the clerk, the attachment or execution creditor shall be subrogated to all the rights of such holder, and the proceeds of the sale of the collateral shall be first applied to the discharge of such indebtedness and the costs incurred under the writ of attachment or execution.
Iowa Code § 626.37