private void ApplicationBarIconButton_Save_Click(object sender, EventArgs e)
        {
            // TODO: Add save operation.
            SettingsRepository settingsRepository = new SettingsRepository();

            Settings settings = settingsRepository.Get();

            // TODO: Add robustness here, probably mostly in input validation.
            ListPickerItem expireItem = this.ExpireAfterDays.SelectedItem as ListPickerItem;

            if (expireItem != null)
            {
                settings.ExpireAfterDays = int.Parse(expireItem.Tag.ToString());
            }

            ListPickerItem item = this.UnitType.SelectedItem as ListPickerItem;

            if (item != null)
            {
                settings.UnitType =
                    (UnitType)Enum.Parse(
                        typeof(UnitType),
                        item.Content.ToString(),
                        false);
            }

            settingsRepository.Save(settings);

            App.ViewModel.LoadData();

            NavigationService.GoBack();
        }
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            SettingsRepository settingsRepository = new SettingsRepository();

            // TODO: Add as field and bind up instead.
            Settings settings = settingsRepository.Get();

            this.ExpireAfterDays.SelectedItem =
                this.ExpireAfterDays.Items
                    .OfType<ListPickerItem>()
                    .Where(i => (string)i.Tag == settings.ExpireAfterDays.ToString())
                    .Single();

            // TODO: Can this be done any nicer?  Make sure it can't error.
            this.UnitType.SelectedItem =
                this.UnitType.Items
                    .OfType<ListPickerItem>()
                    .Where(i => (string)i.Content == settings.UnitType.ToString())
                    .Single();
        }
        // Code to execute when the application is closing (eg, user hit Back)
        // This code will not execute when the application is deactivated
        private void Application_Closing(object sender, ClosingEventArgs e)
        {
            // TODO: This needs putting somewhere better.
            SettingsRepository settingsRepository = new SettingsRepository();

            Settings settings = settingsRepository.Get();

            DateTime expireAfter = DateTime.Now.Date.AddMonths(0 - settings.ExpireAfterDays);

            JourneyRepository journeyRepository = new JourneyRepository();

            journeyRepository.DeleteOlderThan(expireAfter);
        }