protected virtual Task LoadProductCustomerReviewsAsync(List <Product> products, WorkContext workContext) { if (products == null) { throw new ArgumentNullException(nameof(products)); } foreach (var product in products) { //Lazy loading for customer reviews product.CustomerReviews = new MutablePagedList <Model.CustomerReviews.CustomerReview>((pageNumber, pageSize, sortInfos) => { var criteria = new CustomerReviewSearchCriteria { ProductIds = new[] { product.Id }, PageNumber = pageNumber, PageSize = pageSize, Sort = SortInfo.ToString(sortInfos), }; var reviews = _customerReviewService.SearchReviews(criteria); foreach (var review in reviews) { review.ReviewRatings = new MutablePagedList <Model.ReviewRatings.ReviewRating>((pn, ps, si) => { return(_customerReviewService.GetReviewRatings(review.Id)); }, 1, CustomerReviewSearchCriteria.DefaultPageSize); } return(reviews); }, 1, CustomerReviewSearchCriteria.DefaultPageSize); } return(Task.CompletedTask); }