public ListModelBase <CustomerCdContentTrackingModel, CustomerCdConentTrackingModelFilter> GetCustomerCdContentTrackingModel(int pageNumber, int pageSize, ModelFilterBase filter, out int totalRecords) { var eventCustomers = _eventCustomerRepository.GetEventCustomersWithCdPurchase(pageNumber, pageSize, filter as CustomerCdConentTrackingModelFilter, out totalRecords); if (eventCustomers.IsNullOrEmpty()) { return(null); } var customers = _customerRepository.GetCustomers(eventCustomers.Select(ec => ec.CustomerId).ToArray()); var orderIds = _orderRepository.GetOrderEventCustomerIdPairforEventCustomerIds( eventCustomers.Select(ec => ec.Id).ToArray()); var cdContentTrackingList = _cdContentGeneratorTrackingRepository.GetCdContentGeneratedforEventCustomerIds( eventCustomers.Select(ec => ec.Id).ToArray()); var orgRoleUserIds = (from cdContentGeneratorTracking in cdContentTrackingList where cdContentGeneratorTracking.DownloadedByOrgRoleUserId.HasValue select cdContentGeneratorTracking.DownloadedByOrgRoleUserId.Value).ToArray(); var idNamePairs = _orgRoleuserRepository.GetNameIdPairofUsers(orgRoleUserIds); return(_customerCdContentTrackingModelFactory.Create(eventCustomers, customers, orderIds, cdContentTrackingList, idNamePairs)); }