public IDeleteResponse Delete(IIndexablePageData indexablePageData)
        {
            var pageData = indexablePageData as PageData;
            if (pageData == null)
                throw new ArgumentException("Should inherit from PageData", nameof(indexablePageData));

            return
                ElasticClient.Delete(new DeleteRequest(GetAliasName(pageData.Language),
                    TypeName.Create(indexablePageData.GetType()), pageData.ContentGuid));
        }
        public IIndexResponse Index(IIndexablePageData indexablePageData)
        {
            var pageData = indexablePageData as PageData;
            if (pageData == null)
                throw new ArgumentException("Should inherit from PageData", nameof(indexablePageData));

            var indexModel = CreateIndexModel(indexablePageData);

            return ElasticClient.Index(indexModel, x => x.Index(GetAliasName(pageData.Language)));
        }
 private IPageDataIndexModel CreateIndexModel(IIndexablePageData indexablePageData)
 {
     IPageDataIndexModel indexModel;
     try
     {
         indexModel = indexablePageData.CreateIndexModel();
     }
     catch (Exception)
     {
         _logger.Error(
             $"Failed to create index model for page with name: {((PageData)indexablePageData).Name} and contentlink id: {((PageData)indexablePageData).ContentLink.ID}");
         throw;
     }
     return indexModel;
 }