Utility for cloning an object