public async void SaveItems()
        {
            var fileName = PresetViewModel.PresetName + ".preset";

            manager.FileName = fileName;

            var items = (await manager.GetCollection <PresetItemViewModel>()).ToList();

            if (items.Any())
            {
                var result = MessageBox.Show("There already is a preset with that name. Do you want to overwrite it?",
                                             "Saving preset", MessageBoxButton.OKCancel);

                if (result != MessageBoxResult.OK)
                {
                    return;
                }
            }

            await manager.Save(PresetViewModel.PresetItems.ToList());
        }
        public async Task Initialize()
        {
            RecentItems.Clear();
            ShouldShowRecent = true;
            var result = await recentManager.GetCollection <RecentItemViewModel>();

            var partial    = result.OrderByDescending(x => x.LastUsedDate);
            var showRecent = settings.Get <string>("RecentItemsShown").GetOrDefault();
            int takeFirst;

            if (string.IsNullOrEmpty(showRecent) || showRecent.Equals("No limit"))
            {
                RecentItems.AddRange(partial);
            }
            else if (int.TryParse(showRecent, out takeFirst))
            {
                RecentItems.AddRange(partial.Take(takeFirst));
            }
            else
            {
                ShouldShowRecent = false;
            }
        }
        protected override async void OnActivate()
        {
            if (string.IsNullOrEmpty(PresetFileName))
            {
                return;
            }
            maxVolume = settings.Get <int>("MaxVolume").GetOrElse(100);
            MuteVolume();
            NotifyButtons();

            fileManager.FileName = PresetFileName;
            eventAggregator.Publish(new Events.HearingTest.PitchGeneratorChanged(pitchGenerator));
            eventAggregator.Publish(new Events.HearingTest.ChannelChanged(CurrentChannel));
            eventAggregator.Publish(new Events.HearingTest.StopPlaying());
            IsPlaying = false;

            PresetItems     = new ReadOnlyTraversableList <PresetItemViewModel>((await fileManager.GetCollection <PresetItemViewModel>()).ToList());
            ProgressMaximum = PresetItems.Count;
            if (!PresetItems.Any())
            {
                return;
            }

            CurrentItem = PresetItems.Next();
            pitchGenerator.Frequency = CurrentItem.Frequency;
            CurrentFrequency         = CurrentItem.Frequency.ToString(CultureInfo.InvariantCulture);
            NotifyButtons();
        }