private bool IsLocalTagsFileValid()
        {
            if (File.Exists(this.SitecoreTagsFilePath) && File.Exists(this.SitecoreTagsHashFilePath))
            {
                string data;
                using (StreamReader streamReader = new StreamReader(this.SitecoreTagsHashFilePath))
                {
                    data = streamReader.ReadToEnd();
                }

                SitecoreTagsHashEntity sitecoreTagsHashEntity = JsonConvert.DeserializeObject <SitecoreTagsHashEntity>(data);
                if (sitecoreTagsHashEntity != null)
                {
                    if ((DateTime.Now - sitecoreTagsHashEntity.CheckingDate).TotalDays > _SitecoreTagsHashFileCheckingDays)
                    {
                        data = this.DownloadSitecoreTagsFile();
                        if (!string.IsNullOrEmpty(data))
                        {
                            if (this.GenerateFileHash(data) == sitecoreTagsHashEntity.Hash)
                            {
                                return(true);
                            }

                            return(false);
                        }
                    }

                    return(true);
                }
            }

            return(false);
        }
        public string GetTagsData()
        {
            string json;

            if (!this.IsLocalTagsFileValid())
            {
                json = this.DownloadSitecoreTagsFile();
                if (this.IsValidJson(json))
                {
                    File.WriteAllText(this.SitecoreTagsFilePath, json);
                    SitecoreTagsHashEntity sitecoreTagsHashEntity = new SitecoreTagsHashEntity
                    {
                        CheckingDate = DateTime.Now,
                        Hash         = this.GenerateFileHash(json)
                    };
                    File.WriteAllText(this.SitecoreTagsHashFilePath, JsonConvert.SerializeObject(sitecoreTagsHashEntity));
                }
            }
            else
            {
                using (StreamReader streamReader = new StreamReader(this.SitecoreTagsFilePath))
                {
                    json = streamReader.ReadToEnd();
                }
            }

            return(json);
        }