this.setDepartment(null);
this.removeDepartment();
    public void delete() {        if (this.getSubUnits().isEmpty()                && (this.getParentUnits().isEmpty() || this.getParentUnits().size() == 1)                && this.getFunctions().isEmpty() && this.getWorkingContracts().isEmpty()                && this.getMailingContracts().isEmpty() && this.getSalaryContracts().isEmpty()) {            if (!this.getParentUnits().isEmpty()) {                this.removeParentUnits(this.getParentUnits().get(0));            }            this.setDepartment(null);            super.deleteDomainObject();        } else {            throw new DomainException("error.delete.unit");        }    }