public Order AddNewOrderAndItems(Order order) { int orderCounter = 1; var queries = new List <SQLQuery>(); var query = GetOrderQuery(order); query.OrderNumber = orderCounter; query.GroupNumber = 1; queries.Add(query); foreach (OrderItem oi in order.OrderItems) { orderCounter++; var oiQuery = GetOrderItemQuery(oi); oiQuery.OrderNumber = orderCounter; oiQuery.GroupNumber = 2; queries.Add(oiQuery); } queryRunner.RunQueryAsync(queries) .Wait(); return(order); }