public async Task <PaginatedCustomerProfilesModel> GetPaginatedAsync(int currentPage, int pageSize, bool includeNotVerified = false, bool includeNotActive = false) { if (currentPage < 1) { throw new ArgumentException("Current page can't be negative", nameof(currentPage)); } if (pageSize == 0) { throw new ArgumentException("Page size can't be 0", nameof(pageSize)); } var skip = (currentPage - 1) * pageSize; var take = pageSize; var profiles = await _customerProfileRepository.GetPaginatedAsync(skip, take, includeNotVerified, includeNotActive); var totalCount = await _customerProfileRepository.GetTotalAsync(includeNotVerified, includeNotActive); return(new PaginatedCustomerProfilesModel { CurrentPage = currentPage, PageSize = pageSize, Customers = profiles, TotalCount = totalCount }); }