private void OnRemovedFromCache(CacheEntryRemovedArguments args)
        {
            try
            {
                if (args.RemovedReason != CacheEntryRemovedReason.Expired)
                {
                    return;
                }

                CacheItemValue cacheItemValue = (CacheItemValue)args.CacheItem.Value;

                if (cacheItemValue.RetryCount > MaxRetries)
                {
                    return;
                }

                if (IsFileLocked(cacheItemValue.FilePath))
                {
                    cacheItemValue.RetryCount++;
                    _cacheItemPolicy.AbsoluteExpiration = DateTimeOffset.Now.AddSeconds(CacheTimeSeconds);

                    _memCache.Add(cacheItemValue.FileName, cacheItemValue, _cacheItemPolicy);
                    Console.WriteLine("File is locked, waiting to move the file");
                    Trace.TraceInformation("File is locked, waiting to move the file");
                }
                else
                {
                    lock (resourceLock)
                    {
                        Console.WriteLine("Ready to move file");
                        File.Copy(cacheItemValue.FilePath, destination + "\\" + cacheItemValue.FileName);
                        fileSystemWatcher.Dispose();
                        Console.WriteLine("File moved");
                        Trace.TraceInformation("File moved");
                        success = (int)ApplicationResponseTypes.SUCCESS;
                        Environment.Exit(0);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Trace.TraceError(ex.ToString());
            }
        }
        private void OnCreated(object source, FileSystemEventArgs e)
        {
            try
            {
                _cacheItemPolicy.AbsoluteExpiration = DateTimeOffset.Now.AddSeconds(CacheTimeSeconds);

                CacheItemValue fileData = new CacheItemValue()
                {
                    FilePath   = e.FullPath,
                    RetryCount = 0,
                    FileName   = e.Name
                };

                _memCache.AddOrGetExisting(e.Name, fileData, _cacheItemPolicy);

                Console.WriteLine("File Found - " + e.FullPath);
                Trace.TraceInformation("File Found - " + e.FullPath);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                Trace.TraceError(ex.ToString());
            }
        }