private void FillTemplates()
        {
            var settings = mySettingsStore.GetKey <PostfixTemplatesSettings>(SettingsOptimization.OptimizeDefault);

            settings.DisabledProviders.SnapshotAndFreeze();

            PropertyChangedEventHandler handler = (sender, args) =>
            {
                if (args.PropertyName == "IsChecked")
                {
                    var viewModel = (PostfixTemplateViewModel)sender;
                    if (viewModel.IsChecked == viewModel.DefaultValue)
                    {
                        mySettingsStore.RemoveIndexedValue(
                            PostfixSettingsAccessor.DisabledProviders, viewModel.SettingsKey);
                    }
                    else
                    {
                        mySettingsStore.SetIndexedValue(
                            PostfixSettingsAccessor.DisabledProviders, viewModel.SettingsKey, viewModel.IsChecked);
                    }
                }
            };

            var infos = myTemplatesManager.TemplateProvidersInfos;

            foreach (var providerInfo in infos.OrderBy(providerInfo => providerInfo.Metadata.TemplateName))
            {
                var metadata = providerInfo.Metadata;
                // ReSharper disable once SuggestUseVarKeywordEverywhere
                bool isEnabled = (!settings.DisabledProviders.TryGet(providerInfo.SettingsKey, out isEnabled) &&
                                  !metadata.DisabledByDefault) || isEnabled;

                var itemViewModel = new PostfixTemplateViewModel(
                    metadata: metadata, settingsKey: providerInfo.SettingsKey, isChecked: isEnabled);

                itemViewModel.PropertyChanged += handler;
                Templates.Add(itemViewModel);
            }
        }
        private void FillTemplates()
        {
            var settings = mySettingsStore.GetKey<PostfixTemplatesSettings>(SettingsOptimization.OptimizeDefault);
              settings.DisabledProviders.SnapshotAndFreeze();

              PropertyChangedEventHandler handler = (sender, args) =>
              {
            if (args.PropertyName == "IsChecked")
            {
              var viewModel = (PostfixTemplateViewModel) sender;
              if (viewModel.IsChecked == viewModel.DefaultValue)
            mySettingsStore.RemoveIndexedValue(
              PostfixSettingsAccessor.DisabledProviders, viewModel.SettingsKey);
              else
            mySettingsStore.SetIndexedValue(
              PostfixSettingsAccessor.DisabledProviders, viewModel.SettingsKey, viewModel.IsChecked);
            }
              };

              var infos = myTemplatesManager.TemplateProvidersInfos;
              foreach (var providerInfo in infos.OrderBy(providerInfo => providerInfo.Metadata.TemplateName))
              {
            var metadata = providerInfo.Metadata;
            // ReSharper disable once SuggestUseVarKeywordEverywhere
            bool isEnabled = (!settings.DisabledProviders.TryGet(providerInfo.SettingsKey, out isEnabled)
                       && !metadata.DisabledByDefault) || isEnabled;

            var itemViewModel = new PostfixTemplateViewModel(
              metadata: metadata, settingsKey: providerInfo.SettingsKey, isChecked: isEnabled);

            itemViewModel.PropertyChanged += handler;
            Templates.Add(itemViewModel);
              }
        }