The owner of the property on which the improvement is made has the right to demand a bond from the prime contractor to protect the owner in case of the enforcement of a lien under this chapter by one (1) or more remote contractors; and in the event the prime contractor is paid for the work done, or any part of it, that is subject to a lien by a remote contractor, then on payment by the owner to the remote contractor of the amount due, the owner shall have judgment for the amount by filing a complaint, petition, or civil warrant against the bond in any court having jurisdiction in such cases; but the prime contractor shall have the right to contest the legality and amount of the claim of the remote contractors before the prime contractor is held liable.