public async Task <string> ClearJnccIndex()
        {
            var jnccIndexService = new JnccIndexService();
            await jnccIndexService.ClearIndex();

            return("JNCC index cleared successfully");
        }
        public async Task <string> PopulateJnccIndex()
        {
            var env = new Env();
            var jnccIndexService = new JnccIndexService();
            var biotopesList     = new List <string>();

            using (var db = new BiotopeDB())
            {
                foreach (var biotope in db.WEB_BIOTOPE)
                {
                    var formattedTitle       = Regex.Replace(biotope.FULL_TERM, htmlTagRegex, String.Empty);
                    var formattedDescription = string.IsNullOrWhiteSpace(biotope.DESCRIPTION) ? null : Regex.Replace(biotope.DESCRIPTION, htmlTagRegex, String.Empty);
                    var formattedSituation   = string.IsNullOrWhiteSpace(biotope.SITUATION) ? null : Regex.Replace(biotope.SITUATION, htmlTagRegex, String.Empty);

                    var message = new
                    {
                        verb     = "upsert",
                        index    = env.SEARCH_INDEX,
                        document = new
                        {
                            id             = biotope.BIOTOPE_KEY,
                            site           = env.SITE,
                            title          = $"{biotope.ORIGINAL_CODE.Trim()} {formattedTitle}",
                            content        = $"{formattedDescription} {formattedSituation} {GetSpeciesString(biotope)}",
                            url            = env.BIOTOPE_BASE_URL + biotope.BIOTOPE_KEY.ToLower(),
                            resource_type  = "dataset",
                            keywords       = GetKeywords(biotope),
                            published_date = "2015-03"
                        }
                    };

                    var jsonString = JsonConvert.SerializeObject(message, new JsonSerializerSettings
                    {
                        ContractResolver = new CamelCasePropertyNamesContractResolver()
                    });

                    biotopesList.Add(jsonString);
                }
            }

            await jnccIndexService.AddBiotopes(biotopesList);

            return("JNCC indexing completed successfully");
        }