Generic cloning of a hierarchy