public void LoadState()
        {
            using (var sr = new StreamReader(new FileStream(_cacheFilePath, FileMode.OpenOrCreate)))
            {
                var str = sr.ReadToEnd();
                if (str.Length > 0)
                {
                    ReactionImageCache config = null;
                    try
                    {
                        config = JsonConvert.DeserializeObject <ReactionImageCache>(str);
                    }
                    catch (Exception ex)
                    {
                        Log.Logger.Error("An error as occured during parsing of {0} file. Error message: {1}", _cacheFilePath, ex.Message);
                    }
                    if (config != null)
                    {
                        _sentFiles    = config.ValidPaths;
                        _ignoredFiles = config.IgnoredPaths;
                    }
                }
                else
                {
                    Log.Logger.Warning("The file {0} was expected to be populated with data, but was empty.", _cacheFilePath);
                }
            }

            // Remove ignored files from the initialised files list
            _files = _files.Where(f => !_ignoredFiles.Contains(f.FullName)).ToList();
        }
        public void SaveState()
        {
            if (_sentFiles.Count == 0)
            {
                return;
            }

            using (var sw = new StreamWriter(new FileStream(_cacheFilePath, FileMode.Create, FileAccess.Write)))
            {
                var config = new ReactionImageCache()
                {
                    ValidPaths = _sentFiles, IgnoredPaths = _ignoredFiles
                };
                var contents = JsonConvert.SerializeObject(config, Formatting.Indented);
                sw.WriteLine(contents);
            }

            Log.Logger.Debug("ReactionCommand state was successfully saved.");
        }