Employee oEmp = new Employee();
Document e = oEmp.exists(getSession(), "employee_uuid", oUsr.getNickName());
if (e!=null) {
Log.out.debug("Employee already exists");
oEmp.load(getSession(), e.id());
if (!oEmp.parentId().equals(oEms.id()))
oEmp.getDocument().parents().replace(oDms.getDocument(oEmp.parentId()), oDms.getDocument(oEms.id()));
} else {
Log.out.debug("Employee does not exist");
oEmp = new Employee(getSession(), oEms);
oEmp.setUuid(oUsr.getNickName());