object transmutation, based loosely on https://github.com/acumenbrands/alchemist