} else if (((departmentID != null && unit.getType() != null) || departmentID == null) && unit.getDepartment() != null) { unit.removeDepartment();
} else if (unit.getDepartment() != null) { unit.removeDepartment();
    private void setDepartment(Integer departmentID, ISuportePersistente suportePersistente, Unit unit)            throws ExcepcaoPersistencia {        Department department = null;        if (departmentID != null && unit.getType() != null && unit.getType().equals(UnitType.DEPARTMENT)) {            department = (Department) suportePersistente.getIPersistentObject().readByOID(                    Department.class, departmentID);            unit.setDepartment(department);        } else if (((departmentID != null && unit.getType() != null) || departmentID == null)                && unit.getDepartment() != null) {            unit.removeDepartment();        }    }