public async Task <PagedResponse <IEnumerable <GetAllProductsViewModel> > > Handle(GetAllProductsQuery request, CancellationToken cancellationToken) { // Filter params var validFilter = _mapper.Map <GetAllProductsParameter>(request); // Retrieve products filtered by name var products = await _productRepository.SearchByNamePagedReponseAsync(validFilter.PageNumber, validFilter.PageSize, validFilter.Name); // Mapping var productViewModel = _mapper.Map <IEnumerable <GetAllProductsViewModel> >(products); return(new PagedResponse <IEnumerable <GetAllProductsViewModel> >(productViewModel, validFilter.PageNumber, validFilter.PageSize)); }