Where a debt is transferred for the purpose of securing an existing or future debt, the debt so transferred, if received by the transferor or recovered by the transferee, is applicable, first, in payment of the costs of such recovery; secondly, in or towards satisfaction of the amount for the time being secured by the transfer, and the residue, if any, belongs to the transferor or other person entitled to receive the same.