void swap(object pState)
        {
            Thread.Sleep(0);             //Fix for SP1 bug, when timer stops fiaring after a while

            try {
                T.LogRbr(LogSeverity.Debug, "DualRepository.swap", string.Format("PrevIndex: {0} time: {1}", index, DateTime.Now));

                //TODO: this lock should be the same as in CdrAggreqagteExporter otherwise we have potential problem
                lock (CdrAggrExporter.Padlock) {
                    index = nextIndex;
                    repositoryArray[index] = new CdrAggregateRepository();
                    T.LogRbr(LogSeverity.Debug, "DualRepository.swap", string.Format("index: {0} count: {1}", index, repositoryArray[index].Count));
                }

                //--SavePrevious
                savePrevious();
                T.LogRbr(LogSeverity.Debug, "DualRepository.swap", string.Format("index: {0} Seriliazed", index));
            }
            catch (Exception _ex) {
                T.LogRbr(LogSeverity.Critical, "DualRepository.swap", string.Format("Exception:\r\n{0}", _ex));
            }
            finally {
                recycleTimer = new Timer(swap, null, recycleTimerInterval, Timeout.Infinite);
            }
        }
        public DualRepository(IConfiguration pConfiguration, ILogger pLogger)
        {
            configuration = pConfiguration;
            T             = pLogger;
            frequency     = pConfiguration.Main.CdrAggrExportFrequency;
            index         = 0;

#if DEBUG
            frequency = 1;
#endif

            //-- initialize repository array:
            repositoryArray = new CdrAggregateRepository[2];
            try {
                repositoryArray[0] = new CdrAggregateRepository();
                repositoryArray[1] = new CdrAggregateRepository();
            }
            catch (Exception _ex) {
                T.LogRbr(LogSeverity.Debug, "DualRepository.Ctor", "Exception creating repository Array: " + _ex);
            }

            //-- initialize timer
            recycleTimer = new Timer(swap, null, recycleTimerInterval, Timeout.Infinite);
        }