/// <summary>
        /// Handles the callback TabClosed event, removes the closed tab from the 
        /// public session
        /// </summary>
        void OnTabClosed(object sender, TabArgs e)
        {
            System.Windows.Threading.DispatcherOperation op = App.Current.Dispatcher.BeginInvoke
                (
                new Action (() =>
                    {
                        MainWindow main = App.Current.MainWindow as MainWindow;

                        if (main.ClientStatus.IsWatching)
                        {
                            int index = main.dockingManager.Documents.IndexOf(main.dockingManager.ActiveDocument as PublicTab);
                            if (index == 0)
                                if (main.dockingManager.Documents.Count > 1)
                                    TabNext = main.dockingManager.Documents[1] as PublicTab;
                                else
                                    TabNext = null;
                            else if (index != -1)
                                TabNext = main.dockingManager.Documents[index - 1] as PublicTab;
                        }
                        else TabNext = null;

                        PublicSession.Remove((PublicSession.FindByGuid(e.Tab.Id)));
                    })
                );

            op.Completed +=new EventHandler(op_Completed);
        }
        /// <summary>
        /// Handles the callback TabAdded event, adds the received tab to the
        /// public session.
        /// </summary>
        void OnTabAdded(object sender, TabArgs e)
        {
            System.Windows.Threading.DispatcherOperation op = App.Current.Dispatcher.BeginInvoke
                (
                new Action(() =>
                    {
                        TabNext = new PublicTab(e.Tab);
                        PublicSession.Add(TabNext);
                    })
                );

            op.Completed += new EventHandler(op_Completed);
        }