private TestObjectViewModel HasSelectedItem(IEnumerable<TestObjectViewModel> suites,
            TestObjectViewModel selectedSuite)
        {
            foreach (TestObjectViewModel suite in suites)
            {
                if (suite == null) continue;

                if (suite.IsSelected)
                    selectedSuite = suite;
                else if (suite.Children.Count > 0)
                    selectedSuite = HasSelectedItem(suite.Children, selectedSuite);
            }
            return selectedSuite;
        }
        private List<TestObjectViewModel> RecursiveSuiteCollector(TestObjectViewModel item, ITestSuiteBase suite,
          List<TestObjectViewModel> selectedItems)
        {
            IStaticTestSuite staticSuite = null;
            IDynamicTestSuite dynamicSuite = null;
            IRequirementTestSuite requirmentSuite = null;
            ITestSuiteBase suiteBase = TfsShared.Instance.SourceTestProject.TestSuites.Find(item.ID);
            if (suiteBase.TestSuiteType == TestSuiteType.StaticTestSuite)
            {
                staticSuite = (IStaticTestSuite)suiteBase;
                if (item.IsChecked)
                {
                    selectedItems.AddRange(staticSuite.TestCases.Select(test => new TestObjectViewModel(test) { TestSuiteId = suite.Id }));
                    if (staticSuite.SubSuites.Count > 0)
                    {
                        foreach (ITestSuiteBase subSuite in staticSuite.SubSuites)
                        {
                            var children = item.Children.Where(t => t.ID > 0 && t.ID == subSuite.Id);
                            if(children.Count()>0)
                            RecursiveSuiteCollector(children.First(), subSuite, selectedItems);
                        }
                    }
                }
            }
            else if ((suite.TestSuiteType == TestSuiteType.DynamicTestSuite) && (item.IsChecked))
            {
                dynamicSuite = (IDynamicTestSuite)suite;
                selectedItems.AddRange(dynamicSuite.TestCases.Select(test => new TestObjectViewModel(test) { TestSuiteId = suite.Id }));
            }
            else if ((suite.TestSuiteType == TestSuiteType.RequirementTestSuite) && (item.IsChecked))
            {
                requirmentSuite = (IRequirementTestSuite)suite;
                selectedItems.AddRange(requirmentSuite.TestCases.Select(test => new TestObjectViewModel(test) { TestSuiteId = suite.Id }));
            }

            return selectedItems;
        }