public void Update(Order order)
 {
     var orderState = ((IStateSnapshotable<OrderState>) order).TakeSnapshot();
     using (var dataContext = new DataContext()) {
         dataContext.Entry(orderState).State = EntityState.Modified;
         orderState.Lines.ForEach(x => dataContext.Entry(x).State = EntityState.Added);
         dataContext.SaveChanges();
     }
 }
 public void Delete(Guid orderId)
 {
     using (var dataContext = new DataContext()) {
         var orderState = dataContext.Set<OrderState>().Find(orderId);
         dataContext.Entry(orderState).State = EntityState.Deleted;
         orderState.Lines.ForEach(x => dataContext.Entry(x).State = EntityState.Added);
         dataContext.SaveChanges();
     }
 }