if (topUnit.getType().equals(UnitType.DEPARTMENT)
if (topUnit.getType() != null && topUnit.getType().equals(UnitType.DEPARTMENT) && topUnit.getDepartment() != null
    private IDepartment getUnitDepartment(IUnit unit) {        List<IUnit> allTopUnits = unit.getTopUnits();        for (IUnit topUnit : allTopUnits) {            if (topUnit.getType().equals(UnitType.DEPARTMENT)                    && topUnit.getDepartment().getCurrentActiveWorkingEmployees().contains(this)) {                return topUnit.getDepartment();            }        }        return null;    }