private void MealAdded(object sender, MealAddedEventArgs e) { var meal = sender as Meal; if (meal == null) { return; } var id = OrderItems.Count == 0 ? 1 : OrderItems.Max(order => order.Id) + 1; var item = new OrderItem(); item.AddMeal(id, meal, e.MealType); item.OrderDeleted += DeleteOrderItem; OrderItems.Add(item); OnOrderItemAdded(new OrderItemAddedEventArgs { OrderItemAdded = item }); }