If it be clearly shown by the petition, exhibits, and evidence adduced, that the interest of the minor or insane person or convict will be promoted by the sale, lease or encumbrance by mortgage or trust deed, and the court be of opinion that the rights of no person will be affected thereby, it may order such estate, or any part thereof, to be sold, lease, or encumbered by mortgage or trust deed; and in such manner and on such terms and in such parcels as may be deemed most beneficial to the minor or insane person or convict; and, in case the same be decreed to be sold, shall take from the purchaser bond, with ample security, when the sale is on credit. And, in case of sale or lease, the same may be decreed to be made either at public or private sale or lease. At such sale or lease neither the guardian, committee, nor guardian ad litem shall be a purchaser directly or indirectly. But no estate of any minor or insane person or convict shall be sold contrary to the provisions of any will or conveyance by which such estate was devised or granted to such person, if such provision would be valid if contained in a conveyance or devise to a person sui juris.