If an agent receives anything for the benefit of his principal, to the possession of which another person is entitled, he must, on demand, surrender it to such person, or so much of it as he has under his control at the time of demand, on being indemnified for any advance which he has made to his principal, in good faith, on account of the same; and is responsible therefor, if, after notice from the owner, he delivers it to his principal.