protected override void CreateNew(Page?p) { _ = p ?? throw new NullReferenceException(); Window w = p.Parent as Window ?? throw new NullReferenceException(); if (CurrentAbbrev == null || string.IsNullOrEmpty(CurrentAbbrev.ShortForm) || string.IsNullOrEmpty(CurrentAbbrev.FullForm)) { MessageBox.Show(DialogResources.EmptyAbbrevDialog, Resources.Error, MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); return; } var modify = _toModify.With(ShortForm ?? "", FullForm ?? "", GenderForm ?? "", PluralForm ?? "", GenderPluralForm ?? ""); _repositories.Abbreviations.Update(modify); _repositories.Abbreviations.SaveChanges(); CheckDictionaryAdd(); try { w.DialogResult = true; } catch { } finally { w.Close(); } }