public void CreateOrder(int accountID) { int orderID = orderContext.CreateOrder(new Order() { AccountID = accountID }).ID; List <OrderItem> items = new List <OrderItem>(); foreach (BagItem Bagitem in GetBagItems(accountID)) { items.Add( new OrderItem() { OrderID = orderID, ProductID = Bagitem.ProductID } ); } orderItemContext.CreateOrderItems(items); }