Collections.sort(unitEmployeesList, new BeanComparator("unit.costCenterCode"));
unitEmployeesList = filterRepeatedUnits(unitEmployeesList); Collections.sort(unitEmployeesList, new BeanComparator("unitCode"));
    public ActionForward showEmployeeList(ActionMapping mapping, ActionForm form,            HttpServletRequest request, HttpServletResponse response) throws FenixServiceException,            FenixFilterException {        final IUserView userView = SessionUtils.getUserView(request);        YearMonth yearMonth = null;        ViewState viewState = (ViewState) RenderUtils.getViewState();        if (viewState != null) {            yearMonth = (YearMonth) viewState.getMetaObject().getObject();        }        if (yearMonth == null) {            yearMonth = new YearMonth();            yearMonth.setYear(new YearMonthDay().getYear());            yearMonth.setMonth(Month.values()[new YearMonthDay().getMonthOfYear() - 1]);        } else if (yearMonth.getYear() > new YearMonthDay().getYear()                || (yearMonth.getYear() == new YearMonthDay().getYear() && yearMonth.getMonth()                        .compareTo(Month.values()[new YearMonthDay().getMonthOfYear() - 1]) > 0)) {            saveErrors(request, "error.invalidFutureDate");            yearMonth = new YearMonth();            yearMonth.setYear(new YearMonthDay().getYear());            yearMonth.setMonth(Month.values()[new YearMonthDay().getMonthOfYear() - 1]);            request.setAttribute("yearMonth", yearMonth);            return mapping.getInputForward();        } else if (yearMonth.getYear() < 2006                || (yearMonth.getYear() == 2006 && yearMonth.getMonth().compareTo(Month.SEPTEMBER) < 0)) {            saveErrors(request, "error.invalidPastDate");            request.setAttribute("yearMonth", yearMonth);            return mapping.getInputForward();        }        YearMonthDay beginDate = new YearMonthDay(yearMonth.getYear(),                yearMonth.getMonth().ordinal() + 1, 01);        YearMonthDay endDate = new YearMonthDay(yearMonth.getYear(), yearMonth.getMonth().ordinal() + 1,                beginDate.dayOfMonth().getMaximumValue());        request.setAttribute("yearMonth", yearMonth);        List<UnitEmployees> unitEmployeesList = new ArrayList<UnitEmployees>();        for (PersonFunction personFunction : userView.getPerson().getPersonFuntions(beginDate, endDate)) {            if (personFunction.getFunction().getFunctionType() == FunctionType.ASSIDUOUSNESS_RESPONSIBLE) {                List<Employee> employeeList = personFunction.getFunction().getUnit()                        .getAllWorkingEmployees(beginDate, endDate);                if (!employeeList.isEmpty()) {                    UnitEmployees unitEmployees = new UnitEmployees();                    unitEmployees.setUnit(personFunction.getFunction().getUnit());                    unitEmployees.setEmployeeList(employeeList);                    Collections.sort(unitEmployees.getEmployeeList(), new BeanComparator(                            "employeeNumber"));                    unitEmployeesList.add(unitEmployees);                }                for (Unit unit : personFunction.getFunction().getUnit().getAllActiveSubUnits(                        new YearMonthDay())) {                    employeeList = unit.getAllWorkingEmployees(beginDate, endDate);                    if (!employeeList.isEmpty()) {                        UnitEmployees unitEmployees = new UnitEmployees();                        unitEmployees.setUnit(unit);                        unitEmployees.setEmployeeList(employeeList);                        Collections.sort(unitEmployees.getEmployeeList(), new BeanComparator(                                "employeeNumber"));                        unitEmployeesList.add(unitEmployees);                    }                }            }        }        Collections.sort(unitEmployeesList, new BeanComparator("unit.costCenterCode"));        request.setAttribute("unitEmployeesList", unitEmployeesList);        return mapping.findForward("show-employee-list");    }