private void ManageSpecificationsButton_Click(object sender, RoutedEventArgs e)
 {
     var viewModel = new ManageSymbolSpecificationsDialogViewModel(_viewModel.Specifications, _viewModel.CodeStyleItems.ToList(), _languageName, _notificationService);
     var dialog = new ManageNamingStylesInfoDialog(viewModel);
     if (dialog.ShowModal().Value == true)
     {
         _viewModel.UpdateSpecificationList(viewModel);
     }
 }
        internal void UpdateSpecificationList(ManageSymbolSpecificationsDialogViewModel viewModel)
        {
            var symbolSpecifications = viewModel.Items
                                       .Cast <SymbolSpecificationViewModel>()
                                       .Select(
                n =>
                new SymbolSpecification(
                    n.ID,
                    n.ItemName,
                    n.SymbolKindList
                    .Where(s => s.IsChecked)
                    .Select(k => k.CreateSymbolOrTypeOrMethodKind())
                    .ToImmutableArray(),
                    n.AccessibilityList
                    .Where(s => s.IsChecked)
                    .Select(a => a._accessibility)
                    .ToImmutableArray(),
                    n.ModifierList
                    .Where(s => s.IsChecked)
                    .Select(m => new SymbolSpecification.ModifierKind(m._modifier))
                    .ToImmutableArray()
                    )
                );

            Specifications.Clear();
            foreach (var specification in symbolSpecifications)
            {
                Specifications.Add(specification);
            }

            // The existing rules have had their Specifications pulled out from underneath them, so
            // this goes through and resets them.

            foreach (var rule in CodeStyleItems)
            {
                var selectedSpecification = rule.SelectedSpecification;

                rule.Specifications.Clear();
                foreach (var specification in symbolSpecifications)
                {
                    rule.Specifications.Add(specification);
                }

                // Set the SelectedSpecification to null and then back to the actual selected
                // specification to trigger the INotifyPropertyChanged event.

                rule.SelectedSpecification = null;

                if (selectedSpecification != null)
                {
                    rule.SelectedSpecification = rule.Specifications.Single(
                        s => s.ID == selectedSpecification.ID
                        );
                }
            }
        }