public void CancelRequest(int refId)
        {
            try
            {
                RequestCloseStatistic closeStat = RequestCloseStatistic.Create(refId);

                StatSettings.statServerProtocol.Request(closeStat);
            }
            catch (Exception generalExcepiton)
            {
            }
        }
        public static void CloseStatistics(int referenceId)
        {
            try
            {
                RequestCloseStatistic closeStatistics = RequestCloseStatistic.Create(referenceId);
                if (referenceId >= 5000)
                {
                    IMessage response = ((StatServerProtocol)ProtocolManagers.Instance().ProtocolManager[ServerType.Statisticsserver.ToString()]).Request(closeStatistics);

                    if (response != null)
                    {
                        switch (response.Id)
                        {
                        case EventStatisticOpened.MessageId:
                            EventStatisticOpened info = (EventStatisticOpened)response;
                            _logger.Trace("RequestStatistics Method : EventStatisticsOpened : " + info.Name);
                            break;

                        case EventError.MessageId:
                            EventError eventError = (EventError)response;
                            _logger.Trace("RequestStatistics Method : EventError : " + eventError.StringValue);
                            break;

                        case EventStatisticClosed.MessageId:
                            EventStatisticClosed statisticClosed = (EventStatisticClosed)response;
                            _logger.Trace("StatisticClosed : EventStatisticClosed : " + statisticClosed.ReferenceId);
                            break;
                        }
                    }
                }
            }
            catch (Exception generalException)
            {
                _logger.Error("Error occurred while closing the statistics with Ref Id : " + referenceId + " " +
                              (generalException.InnerException == null ? generalException.Message : generalException.InnerException.ToString()));
            }
        }