public IActionResult ParseSpeectToTextAzure([FromBody] ClientWavObject clientInput)
        {
            // return Ok();
            var sw = new Stopwatch();

            sw.Start();

            //Language can be set in the url
            var input  = new[] { "https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?language=en-GB&format=detailed", clientInput.Base64String };
            var result = _bingSpeechService.ParseSpeectToText(input);

            if (result == null)
            {
                return(BadRequest("An unknown error has occured"));
            }

            sw.Stop();
            result.TotalBackendTimeInMilliseconds = sw.ElapsedMilliseconds;
            return(Ok(result));
        }
        public async Task <IActionResult> AzureTranslate([FromBody] ClientTranslationInput clientInput)
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();

            //Language can be set in the url
            string[] input = new[] { $"https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?language={clientInput.InputLanguage}&format=detailed", clientInput.Base64String };
            SpeechRecognitionResult textResult = _bingSpeechService.ParseSpeectToText(input);

            string detectedText = "";

            try
            {
                JObject json = JObject.Parse(textResult.JSONResult);
                detectedText = json["NBest"][0]["Display"].ToString();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            if (string.IsNullOrEmpty(detectedText))
            {
                sw.Stop();
                return(BadRequest("No text detected"));
            }

            TextTranslationResult result = await Task.Run(() => _azureTextTranslatorService.TranslateText(detectedText, clientInput.OutputLanguages.ToList()));

            if (result == null)
            {
                sw.Stop();
                return(BadRequest("An unknown error has occured"));
            }

            sw.Stop();
            result.TotalBackendTimeInMilliseconds = sw.ElapsedMilliseconds;
            result.DetectedText = detectedText;
            return(Ok(result));
        }