public async Task <ICollection <TIndex> > IndexAsync(IReadOnlyCollection <TEntity> entities) { var indexes = entities.Select(_converter.Convert) .ToList(); var response = await _elasticSearchService.AddEntitiesAsync(indexes); if (response.IsOk) { return(indexes); } Logger.LogError($"An error occured during indexing into {typeof(TIndex).Name}", response.Exception); throw new ElasticSearchException($"An error occured during indexing into {typeof(TIndex).Name}", response.Exception); }