Section 40. If a debtor residing in the commonwealth has made an assignment to a trustee for the benefit of his creditors, the acts of the trustee thereunder in protecting and caring for the property and converting it into money, if done in good faith and with reasonable judgment and discretion, shall, subject to the following section, be valid notwithstanding subsequent proceedings in insolvency by or against the debtor, and the assignee in insolvency shall, if such assignment is avoided by him, recover the net amount of money received for, or the price of, the property sold and converted by such trustee instead of the property itself.