public async Task <IDictionary <Guid, Customer> > ByOrders(string orderIds) { var manyToManyRepo = new CustomerOrderRepository(); var _orderIds = orderIds.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) .Select(id => Guid.Parse(id)) .ToList(); var allCustomers = await _repository.Customers(); var allManyToMany = await manyToManyRepo.CustomerOrderRelationships(); var data = allManyToMany .Where(r => _orderIds.Contains(r.OrderId)) .Join(allCustomers, r => r.CustomerId, c => c.Id, (r, c) => { return(new { Customer = c, OrderId = r.OrderId }); }) .ToDictionary(a => a.OrderId, a => a.Customer); return(data); }