/// <summary>
        /// IPC Event listen thread.  Listens for IPC events and inserts into Tree Model view.
        /// </summary>
        /// <param name="data"></param>
        private void ListenThreadImpl(object data)
        {
            active = true;

            while (active)
            {
                try
                {
                    //poll client session every xx mins
                    TimeSpan timespan2 = (DateTime.Now - _lastSessionPollAttempt);
                    double timePassed2 = 0;
                    timePassed2 = timespan2.TotalMinutes;

                    if (timePassed2 > POLL_CLIENT_SESSION_EVERY_MINS)
                    {
                        Trace.TraceInformation("TreeModelAdapter [" + _callerSessionID + "]: Polling client session");
                        _lastSessionPollAttempt = DateTime.Now;
                        _webPageSR.PollSession(_callerSessionID);

                    }

                    //check for events
                    if (_ipcEventQueue.Count > 0)
                    {
                        Niawa.IpcController.IpcEvent evt = _ipcEventQueue.Dequeue();

                        Trace.TraceInformation("TreeModelAdapter [" + _callerSessionID + "]: Received event ID [" + evt.SerialID.ToString() + "] sender [" + evt.ApplicationInstance + "] type [" + evt.EventType + "]");

                        try
                        {
                            //check tree status for this thread
                            //deserialize message detail
                            SortedList<string, string> messageDetailDeserialized = Newtonsoft.Json.JsonConvert.DeserializeObject<SortedList<string, string>>(evt.EventMessageDetail);

                            TreeModel.TreeModelEventImpl tmEvt = new TreeModel.TreeModelEventImpl();
                            tmEvt.IpcEvent = evt;
                            tmEvt.NodeID = evt.NodeID;
                            tmEvt.ParentNodeID = evt.ParentNodeID;
                            tmEvt.NodeText = evt.ApplicationInstance;

                            //add or update node in tree model
                            //cache or display event in tree model view
                            _treeModelController.AddEventToQueue(tmEvt);

                        }
                        catch (Exception ex11)
                        {
                            //exception while updating tree model
                            Trace.TraceError("TreeModelAdapter [" + _callerSessionID + "]: IPC Event Thread Listener Error while updating tree model: " + ex11.Message + ex11.StackTrace);

                        }

                    }
                    else
                    {
                        //there are no messages to consume
                    }

                    System.Threading.Thread.Sleep(50);
                }
                catch (System.Threading.ThreadAbortException) // ex1)
                {
                    //thread was aborted
                    break;
                }
                catch (System.Threading.ThreadInterruptedException) // ex1)
                {
                    //thread was interrupted
                    break;
                }
                catch (Exception ex1)
                {
                    //exception in the thread
                    Trace.TraceError("TreeModelAdapter [" + _callerSessionID + "]: IPC Event Thread Listener Error: " + ex1.Message + ex1.StackTrace, ex1);

                    System.Threading.Thread.Sleep(100);
                }

            }
        }
        /// <summary>
        /// IPC Event listen thread.  Listens for IPC events and inserts into Tree Model view.
        /// </summary>
        /// <param name="data"></param>
        private void ListenThreadImpl(object data)
        {
            active = true;

            while (active)
            {
                try
                {

                    //check for events
                    if (_ipcEventQueue.Count > 0)
                    {
                        Niawa.IpcController.IpcEvent evt = _ipcEventQueue.Dequeue();

                        Trace.TraceInformation("TreeModelCacheAdapter: Received event ID [" + evt.SerialID.ToString() + "] sender [" + evt.ApplicationInstance + "] type [" + evt.EventType + "]");

                        try
                        {
                            //check tree status for this thread
                            //deserialize message detail
                            SortedList<string, string> messageDetailDeserialized = Newtonsoft.Json.JsonConvert.DeserializeObject<SortedList<string, string>>(evt.EventMessageDetail);

                            TreeModel.TreeModelEventImpl tmEvt = new TreeModel.TreeModelEventImpl();
                            tmEvt.IpcEvent = evt;
                            tmEvt.NodeID = evt.NodeID;
                            tmEvt.ParentNodeID = evt.ParentNodeID;
                            tmEvt.NodeText = evt.ApplicationInstance;

                            //add or update node in tree model
                            //cache or display event in tree model view
                            _treeModelController.AddEventToQueue(tmEvt);

                        }
                        catch (Exception ex11)
                        {
                            //exception while updating tree model
                            Trace.TraceError("TreeModelCacheAdapter: IPC Event Thread Listener Error while updating tree model: " + ex11.Message + ex11.StackTrace);

                        }

                    }
                    else
                    {
                        //there are no messages to consume
                    }

                    System.Threading.Thread.Sleep(50);
                }
                catch (System.Threading.ThreadAbortException) // ex1)
                {
                    //thread was aborted
                    break;
                }
                catch (System.Threading.ThreadInterruptedException) // ex1)
                {
                    //thread was interrupted
                    break;
                }
                catch (Exception ex1)
                {
                    //exception in the thread
                    Trace.TraceError("TreeModelCacheAdapter: IPC Event Thread Listener Error: " + ex1.Message + ex1.StackTrace, ex1);

                    System.Threading.Thread.Sleep(100);
                }

            }
        }