private void ReQueryOrders(object sender, EventArgs e) { var oldMergeOption = DataService.MergeOption; DataService.MergeOption = MergeOption.OverwriteChanges; var orders = DataService.Orders.Expand("OrderItems").Where(x => x.OrderStateId == OrderStates.Cooking).ToList(); foreach (var order in orders.Where(order => !PendingOrders.Contains(order))) { PendingOrders.Add(order); } foreach (var pendingOrder in PendingOrders.Where(pendingOrder => !orders.Contains(pendingOrder))) { PendingOrders.Remove(pendingOrder); } DataService.MergeOption = oldMergeOption; }