private OutboundCallQueueListModel OutboundCallQueueListModel(IEnumerable <CallQueueCustomer> callQueueCustomers, string customerTags) { var customerIds = callQueueCustomers.Where(cqc => cqc.CustomerId.HasValue && cqc.CustomerId.Value > 0).Select(cqc => cqc.CustomerId.Value).ToArray(); IEnumerable <Customer> customers = null; if (customerIds.Any()) { customerIds = customerIds.Distinct().ToArray(); customers = _customerRepository.GetCustomers(customerIds); } var prospectCustomers = _prospectCustomerRepository.GetProspectCustomersByCustomerIds(customerIds); var callQueueCustomerCalls = _callCenterCallRepository.GetCallForHealtPlanCallQueueCustomer(customerIds, customerTags); IEnumerable <CallCenterNotes> callCenterNotes = null; if (callQueueCustomerCalls != null && callQueueCustomerCalls.Any()) { callCenterNotes = _callCenterNotesRepository.GetByCallIds(callQueueCustomerCalls.Select(s => s.CallId)); } var corporateCustomTags = _corporateCustomerCustomTagRepository.GetByCustomerIds(customerIds); return(_outboundCallQueueListModelFactory.SystemGeneratedCallQueueCustomers(callQueueCustomers, customers, prospectCustomers, callQueueCustomerCalls, callCenterNotes, null, null, corporateCustomTags)); }