public PaginatedElement <Alarm> GetByPool(int id, IFilter <Alarm> filter, int rowsPerPage, int pageNumber, User user = null) { if (user != null) { filter = new IdentityAlarmFilter(filter, user); } IEnumerable <Alarm> alarms = alarmRepository.GetByPool(id, filter, rowsPerPage, pageNumber); int totalElementCount = alarmRepository.CountByPool(id, filter); return(new PaginatedElement <Alarm> { TotalElementCount = totalElementCount, Elements = alarms, PageCount = RestApiHelper.GetPageCount(totalElementCount, rowsPerPage) }); }