public async Task <SportListResponse> ListAsync(int pageNum = 1, int pageSize = 50) { if (pageNum < 1 || pageSize < 1) { return(new SportListResponse(400, "Wrong pagination", "Pagination", "The pageNum and pageSize params must be greater than zero.")); } int totalRecords = await _sportRepository.CountAsync(); var sports = await _sportRepository.ListAsync(pageNum, pageSize); var resourcesSports = _mapper.Map <IEnumerable <Sport>, IEnumerable <SportResource> >(sports); var resourceListSports = new SportListResource(resourcesSports, pageNum, pageSize, totalRecords); return(new SportListResponse(resourceListSports)); }