/// <summary>
        /// Refresh cached data.
        /// </summary>
        public void UpdateCache()
        {
            TaxonInformationCache = new TaxonInformationCache();
            TaxonInformationCache.Init();

            LoadTaxonListInformation();

            try
            {
                // Save cache to file.
                var cacheFileName = GetCacheFileName();
                if (File.Exists(cacheFileName))
                {
                    File.Delete(cacheFileName);
                }

                FileSystemManager.EnsureFolderExists(cacheFileName);
                using (var stream = File.Open(
                           cacheFileName,
                           FileMode.OpenOrCreate,
                           FileAccess.Write,
                           FileShare.None))
                {
                    var formatter = new BinaryFormatter();
                    formatter.Serialize(stream, TaxonInformationCache);
                    stream.Flush(true);
                    stream.Close();
                }
            }
            catch (Exception ex)
            {
                mIsInitialized = false;
                throw new Exception("Failed to refresh TaxonInformationListManager cache", ex);
            }
        }
        /// <summary>
        /// Init taxon list information cache.
        /// </summary>
        public void InitCache()
        {
            var cacheFileName = GetCacheFileName();

            // Reset old cache
            TaxonInformationCache = null;

            try
            {
                // Try to read from cached file.
                if (File.Exists(cacheFileName))
                {
                    using (FileStream stream = File.Open(
                               cacheFileName,
                               FileMode.Open,
                               FileAccess.Read,
                               FileShare.Read))
                    {
                        var formatter = new BinaryFormatter();
                        TaxonInformationCache = (TaxonInformationCache)formatter.Deserialize(stream);
                        stream.Close();
                        if (!TaxonInformationCache.IsOk())
                        {
                            TaxonInformationCache = null;
                        }
                    }
                }
            }
            catch
            {
                TaxonInformationCache = null;
            }

            if (TaxonInformationCache.IsNull())
            {
                //mLogger.Debug("Invalid definition of TaxonInformationCache, start updating...");
                UpdateCache();
                //mLogger.Debug("TaxonInformationCache updated...");
            }

            mIsInitialized = true;
        }
 /// <summary>
 /// Static constructor.
 /// </summary>
 private TaxonListInformationManager()
 {
     mTaxonInformationCache = new TaxonInformationCache();
     mContext = CoreData.UserManager.GetApplicationContext();
 }