public void AddNewTabItem(Test test)
        {
            foreach (TabItem x in mainTabControl.Items) //check if tab for thet test alredy exist
            {
                if (x is TestTabItem && (x as TestTabItem).test.Id == test.Id)
                {
                    generator.StartGenerateTest(x as TestTabItem);
                    return;
                }
            }
            TestTabItem newTabItem = new TestTabItem
            {
                test   = test,
                Header = test.Name,
                Name   = "Test" + test.Id
            };

            mainTabControl.Items.Add(newTabItem);
            generator.StartGenerateTest(newTabItem);
        }
        public void AddNewTabItem(Test test)
        {
            foreach (TabItem x in mainTabControl.Items) //check if tab for thet test alredy exist
            {
                // Review TK: You could just write (x as TestTabItem)?.test.Id == test.Id
                if (x is TestTabItem && (x as TestTabItem).test.Id == test.Id)
                {
                    // Review TK: Please don't abuse safe casting.
                    generator.StartGenerateTest(x as TestTabItem);
                    return;
                }
            }
            TestTabItem newTabItem = new TestTabItem
            {
                test   = test,
                Header = test.Name,
                Name   = "Test" + test.Id
            };

            mainTabControl.Items.Add(newTabItem);
            generator.StartGenerateTest(newTabItem);
        }