public async Task <List <Comment> > CalculateCommentsSentimentScoreAsync(List <Comment> comments)
        {
            var getSentimentAnalysisRequest = new GetSentimentAnalysisRequest();

            comments.ForEach(comment =>
            {
                var multiLanguageInput = new GetSentimentAnalysisRequestItem()
                {
                    Language = LANG,
                    Id       = comment.ID.ToString(),
                    Text     = comment.Content
                };

                getSentimentAnalysisRequest.Documents.Add(multiLanguageInput);
            });

            GetSentimentAnalysisResponse getSentimentAnalysisResponse = await _textAnalyticsService.GetSentimentAsync(getSentimentAnalysisRequest);

            if (getSentimentAnalysisResponse != null && getSentimentAnalysisResponse.Documents.Count > 0)
            {
                // Add sentiment analysis result to the comments
                foreach (GetSentimentAnalysisResponseItem getSentimentAnalysisResponseItem in getSentimentAnalysisResponse.Documents)
                {
                    Comment comment = comments.FirstOrDefault(c => c.ID == Convert.ToInt32(getSentimentAnalysisResponseItem.Id));

                    comment.SentimentScore = getSentimentAnalysisResponseItem.Score;
                }
            }

            return(comments);
        }
        public async Task <GetSentimentAnalysisResponse> GetSentimentAsync(GetSentimentAnalysisRequest request)
        {
            HttpClient client = _httpClientFactory.CreateClient("TextAnalyticsAPI");

            var sentimentResponse = await client.PostAsJsonAsync(
                requestUri : _configuration.GetValue <string>("TextAnalyticsAPISentimentResourceURI"),
                value : request);

            GetSentimentAnalysisResponse getSentimentAnalysisResponse = null;

            if (sentimentResponse.StatusCode == HttpStatusCode.OK)
            {
                getSentimentAnalysisResponse = await sentimentResponse.Content.ReadAsAsync <GetSentimentAnalysisResponse>();
            }

            return(getSentimentAnalysisResponse);
        }