public MainWindow()
        {
            // Init UI Componets & page system
            InitializeComponent();

            try
            {     
                ModelFacade = new ModelFacade(FilterType.TestTemplate);
                paging = new Paging(this);

                pageTransition.ShowPage(new homeView(this));
            }
            catch (Exception ex)
            {
                ShowError(ex.Message,true);
            }
 

        }
        private void DeleteQuestionGroup_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Validate.SelectedItemNotNull(QuestionGroupListBox);
                QuestionGroup selectedQuestionGroup = QuestionGroupListBox.SelectedItem as QuestionGroup;
                mainWindow.ModelFacade.Filter.QuestionGroups.Remove(selectedQuestionGroup);
                saveAndRefresh();

                var LoadedFilterType = mainWindow.ModelFacade.Filter.Type;

                if (LoadedFilterType != FilterType.TestTemplate)
                {
                    if (LoadedFilterType != FilterType.DanishTemplate)
                    {
                        var mf = new ModelFacade(FilterType.DanishTemplate);
                        mf.Filter.QuestionGroups.Remove(mf.FindQuestionGroup(selectedQuestionGroup.Id));
                        mf.Save();
                    }
                    if (LoadedFilterType != FilterType.EnglishTemplate)
                    {
                        var mf = new ModelFacade(FilterType.EnglishTemplate);
                        mf.Filter.QuestionGroups.Remove(mf.FindQuestionGroup(selectedQuestionGroup.Id));
                        mf.Save();
                    }
                    if (LoadedFilterType != FilterType.DeutschTemplate)
                    {
                        var mf = new ModelFacade(FilterType.DeutschTemplate);
                        mf.Filter.QuestionGroups.Remove(mf.FindQuestionGroup(selectedQuestionGroup.Id));
                        mf.Save();
                    }
                }

            }
            catch (Exception ex)
            {
                mainWindow.ShowError(ex.Message, true);
            }
        }
 private void LangChange_Click(object sender, RoutedEventArgs e)
 {
     MenuItem item = sender as MenuItem;
     if (item.Name == "dk")
     {
         ModelFacade = new ModelFacade(FilterType.DanishTemplate);
         pageTransition.ShowPage(new homeView(this));
     }
     if (item.Name == "de")
     {
         ModelFacade = new ModelFacade(FilterType.DeutschTemplate);
         pageTransition.ShowPage(new homeView(this));
     }
     if (item.Name == "en")
     {
         ModelFacade = new ModelFacade(FilterType.EnglishTemplate);
         pageTransition.ShowPage(new homeView(this));
     }
     if (item.Name == "test")
     {
         ModelFacade = new ModelFacade(FilterType.TestTemplate);
         pageTransition.ShowPage(new homeView(this));
     }
 }
        // Window Event
        private void createNewQuestionGroup(string title, decimal rank, string info)
        {
            QuestionGroup questionGroup = new QuestionGroup()
            {
                Info = info,
                Title = title,
                Rank = rank
            };
            QuestionGroup questionGroupNotTranslated = new QuestionGroup()
            {
                Id = questionGroup.Id,
                Info = info,
                Title = title   + " (not translated)",
                Rank = rank
            };
            mainWindow.ModelFacade.Filter.QuestionGroups.Add(questionGroup);
            saveAndRefresh();

            var LoadedFilterType = mainWindow.ModelFacade.Filter.Type;

            if (LoadedFilterType != FilterType.TestTemplate)
            {
                if (LoadedFilterType != FilterType.DanishTemplate)
                {
                    var mf = new ModelFacade(FilterType.DanishTemplate);
                    mf.Filter.QuestionGroups.Add(questionGroupNotTranslated);
                    mf.Save();
                }
                if (LoadedFilterType != FilterType.EnglishTemplate)
                {
                    var mf = new ModelFacade(FilterType.EnglishTemplate);
                    mf.Filter.QuestionGroups.Add(questionGroupNotTranslated);
                    mf.Save();
                }
                if (LoadedFilterType != FilterType.DeutschTemplate)
                {
                    var mf = new ModelFacade(FilterType.DeutschTemplate);
                    mf.Filter.QuestionGroups.Add(questionGroupNotTranslated);
                    mf.Save();
                }
            }

        }