If any person liable as bail, surety, guarantor or endorser, or any sheriff liable for not taking sufficient bail, or the committee, heir, or personal representative of any so liable, shall pay, in whole or in part, any judgment, decree or execution rendered or awarded on account of such liability, the person having right of action for the amount so paid, may, by motion in the court in which said judgment, decree, or execution was rendered or awarded, obtain judgment or decree against any person against whom such right of action exists for the amount so paid, with interest from the time of payment, and five percent damages on said amount; and said person so paying in whole or in part, any such judgment, decree or execution rendered or awarded on account of such liability, or any such note, bond or other demand, in whole or in part, shall by operation of law, in addition to the remedy above provided, be substituted to and become the owner of all of the rights and remedies of the creditor for the enforcement and collection of the amount or amounts so paid, and shall be deemed the assignee thereof; executions, or other legal process to which the principal creditor was entitled, may be issued on any such judgment or decree in the name of the original creditor against the person primarily liable for the benefit of the person secondarily liable to the extent to which he has satisfied the original creditor; but nothing in this section shall be construed to impair or affect in any way the security of the original creditor, or his rights and remedies as to any balance which may be due him The provisions of this section are cumulative, and are intended to protect the rights of any person secondarily liable to the extent to which he has satisfied the obligation of the person primarily liable. All assignments heretofore made of judgments and decrees to persons secondarily liable are hereby validated, and upon the same executions may be issued as hereinbefore provided.