/// <summary>
        /// Utility function called by connectionMonitorThread to detect a change in the connection status.
        /// </summary>
        /// <param name="_isRegistered"></param>
        /// <param name="_isLoggedIn"></param>
        /// <returns>_isLogged, will be returned false if there are any errors in setting up after a login event</returns>
        private static bool checkForConnectionStatusChange(bool _isRegistered, bool _isLoggedIn)
        {
            bool statusChange = false;

            if (_isRegistered != isRegistered || _isLoggedIn != isLoggedIn)
            {
                //status change
                isRegistered = _isRegistered;
                isLoggedIn   = _isLoggedIn;
                statusChange = true;
            }
            if (statusChange)
            {
                JObject connectionStatus = new JObject();
                connectionStatus.Add("registered", isRegistered);
                connectionStatus.Add("loggedIn", isLoggedIn);
                FSBL.RouterClient.Transmit("BBG_connection_status", connectionStatus);
                FSBL.Logger.Log("Bloomberg connection status changed: ", connectionStatus);

                if (isLoggedIn)                 //we've just logged in
                {
                    try
                    {
                        //setup a handler for group events
                        BlpTerminal.GroupEvent += BlpTerminal_ComponentGroupEvent;

                        //setup security finder
                        secFinder = new SecurityLookup();
                        secFinder.Init();
                    }
                    catch (Exception err)
                    {
                        _isLoggedIn = false;
                        FSBL.Logger.Error("Error occurred during post-login setup: ", err.Message);
                    }
                }
                else
                {
                    try
                    {
                        //dispose of security finder
                        if (secFinder != null)
                        {
                            secFinder.Dispose();
                            secFinder = null;
                        }
                    }
                    catch (Exception err)
                    {
                        FSBL.Logger.Debug("Exception occurred during disposal of security finder:", err.Message);
                    }
                }
            }

            return(_isLoggedIn);
        }
        /// <summary>
        /// Remove query responders, used on shutdown.
        /// </summary>
        private static void removeResponders()
        {
            FSBL.Logger.Log("Removing query responders");
            FSBL.RouterClient.RemoveResponder("BBG_connection_status", true);
            FSBL.RouterClient.RemoveResponder("BBG_run_terminal_function", true);

            //dispose of security finder
            if (secFinder != null)
            {
                secFinder.Dispose();
                secFinder = null;
            }
        }