I would assume that if you make a deep copy with CopytUtil.copy then the newly created encounter is consistent and obs, orders, providers already reference the newly created encounter. So fix CopyUtil.copy to do what you do here.