private void ImportFeats()
 {
     foreach (FeatModel featModel in _feats)
     {
         if (_addAllEntries)
         {
             _compendium.AddFeat(featModel);
         }
         else if (_skipDuplicateEntries)
         {
             if (!_compendium.Feats.Any(x => x.Name.Equals(featModel.Name, StringComparison.CurrentCultureIgnoreCase)))
             {
                 _compendium.AddFeat(featModel);
             }
         }
         else if (_replaceExistingEntries)
         {
             FeatModel existing = _compendium.Feats.FirstOrDefault(x => x.Name.Equals(featModel.Name, StringComparison.CurrentCultureIgnoreCase));
             if (existing == null)
             {
                 _compendium.AddFeat(featModel);
             }
             else
             {
                 featModel.Id = existing.Id;
                 _compendium.UpdateFeat(featModel);
             }
         }
     }
 }
        private void Add()
        {
            bool addFeat = true;

            if (_editFeatXML != null)
            {
                if (_editHasUnsavedChanges)
                {
                    string body = String.Format("{0} has unsaved changes.{1}What would you like to do?",
                                                _selectedFeat.Name, Environment.NewLine + Environment.NewLine);
                    string accept = "Save and Continue";
                    string reject = "Discard Changes";
                    string cancel = "Cancel Navigation";
                    bool?  result = _dialogService.ShowConfirmationDialog("Unsaved Changes", body, accept, reject, cancel);

                    if (result == true)
                    {
                        if (!SaveEditFeat())
                        {
                            addFeat = false;
                        }
                    }
                    else if (result == false)
                    {
                        CancelEditFeat();
                    }
                    else
                    {
                        addFeat = false;
                    }
                }
                else
                {
                    CancelEditFeat();
                }
            }

            if (addFeat)
            {
                string xml = "<name>New Feat</name><prerequisite></prerequisite><text></text>";

                FeatModel featModel = _xmlImporter.GetFeat(xml);

                _compendium.AddFeat(featModel);

                if (_featSearchService.SearchInputApplies(_featSearchInput, featModel))
                {
                    FeatListItemViewModel listItem = new FeatListItemViewModel(featModel);
                    _feats.Add(listItem);
                    foreach (FeatListItemViewModel item in _feats)
                    {
                        item.IsSelected = false;
                    }
                    listItem.IsSelected = true;
                }

                _selectedFeat = new FeatViewModel(featModel);

                _editFeatXML = featModel.XML;

                SortFeats();

                _compendium.SaveFeats();

                OnPropertyChanged(nameof(EditingFeatXML));
                OnPropertyChanged(nameof(IsEditingFeat));
                OnPropertyChanged(nameof(SelectedFeat));
            }
        }