public GamesTransferModel GetGamesByFilter(GamesFilterModel filterModel, PaginationModel paginationModel) { var container = new GameFilterContainer { Model = filterModel, }; IPipeline <GameFilterContainer> pipeline = GetPipelineWithFilters(); pipeline.ExecuteAll(container); Func <Game, bool> resultCondition = CombinePredicate <Game> .CombineWithAnd(container.Conditions); IEnumerable <Game> games = _unitOfWork.GameRepository.GetMany( resultCondition, (int)paginationModel.PageCapacity, paginationModel.CurrentPage, container.SortCondition); var gameModels = Mapper.Map <IEnumerable <GameModel> >(games); paginationModel.ItemsNumber = _unitOfWork.GameRepository.GetCount(resultCondition); var transferModel = new GamesTransferModel { Games = gameModels, PaginationModel = paginationModel, }; return(transferModel); }