public async Task <ServiceResult <PaginatedListResult <ProductsResponseViewModel> > > Search(ProductsRequestViewModel viewModel) { var paginatedListWithModel = await _repository.Search(viewModel); // Mapping List <ProductsResponseViewModel> Mapping(List <Product> list) { return(list? .Select(model => new ProductsResponseViewModel { Id = model.Id, ProductName = model.Name, Code = model.Code, EanCode = model.EanCode, SellPriceBruto = model.Price, Type = model.ProductType, ProductGroup = model.ProductCategory?.Name }) .ToList()); } var paginatedListWithViewModel = paginatedListWithModel.Copy(Mapping); return(ServiceResultFactory.Success(paginatedListWithViewModel)); }