private void DeleteArea(object sender, RoutedEventArgs e) { string areaTitle = PromptDialog.Prompt("Type the name of this area (to be sure you delete the right area)", "Delete area"); AreaProxy proxy = ((MenuItem)sender).DataContext as AreaProxy; if (!string.IsNullOrWhiteSpace(areaTitle) && areaTitle.Equals(proxy.Title)) { ProjectProxy projectProxy = this.UIProjectProxyList.Where(proj => proj.Areas.Any(a => a.ID == proxy.ID)).FirstOrDefault(); if (projectProxy != null) { AreaManager areaManager = new AreaManager(); areaManager.DeleteById(proxy.ID); projectProxy.Areas.Remove(proxy); } } }