private int IndexOfInstance(TabViewModel tab)
        {
            for (int i = 0; i < Tabs.Count; i++)
            {
                if (Tabs.ElementAt(i).Equals(tab))
                    return i;
            }

            for (int i = 0; i < Tabs.Count; i++)
            {
                if (Tabs.ElementAt(i).GetType().Name == tab.GetType().Name)
                    return i;
            }

            return -1;
        }
 private void SetActiveTab(TabViewModel tab)
 {
     int index = IndexOfInstance(tab);
     if (index != -1)
         ActiveTabIndex = index;
 }
        private int CountTabClassInstancesInTabs(TabViewModel tab)
        {
            int count = 0;
            for (int i = 0; i < Tabs.Count; i++)
            {
                if (Tabs.ElementAt(i).GetType().Name == tab.GetType().Name)
                    count++;
            }

            return count;
        }