I'm stumbling upon a small issue when retrieving a set of data with Entity Framework 5 Code First. Here's my code:

```
var data = context.Customers
            .Include("Orders")
            .Include("Orders.Items")
            .Include("Orders.Items.Article").ToArray();
foreach (var customer in data)
{
    customer.Orders = customer.Orders.OrderByDescending(o => o.OrderDate).ToArray();
}

```

This works (whoo!). But, I'm trying to get that `foreach` out of there, I want the database engine to remain responsible for processing data. How do I do this? 

I've tried this type of join:

```
var data = from customer
           in context.Customers
           select new {
               customer.Id,
               customer.Name,
               // customer.Orders below doesn't have an Include() to include order items
               Orders = customer.Orders.OrderByDescending(b => b.OrderDate)
           };

// Translate anonymous object to actual models
var customers = new List<CustomerModel>();
foreach (var customer in data)
{
    customers.Add(new CustomerModel()
    {
        Id = customer.Id,
        Name = customer.Name,
        Orders = customer.Orders.ToArray()
    });
}

```

But, as the comment says, `customer.Orders` doesn't have an `Include()` method to include items and articles belonging to those items. I then tried to get in from the `context` instead of the `customer` object:

`Orders = context.Orders.Include("Items").Where(o => o.Id == customer.Id)`

But this results in a runtime exception that `Include()` cannot be used this way (in nested queries?):

```
Method 'System.Data.Entity.Infrastructure.DbQuery`1[MyTests.Models.OrderModel] Include(System.String)' declared on type 'System.Data.Entity.Infrastructure.DbQuery`1[MyTests.Models.OrderModel]' cannot be called with instance of type 'System.Data.Objects.ObjectQuery`1[MyTests.Models.OrdersModel]'

```

Is something like that even possible, nesting it out like that?

**How do I make the database process the data instead of using a `foreach` in my first code block?**

Thanks in advance.

JP