public IActionResult ParseSpeectToTextWatson([FromBody] ClientWavObject clientInput)
        {
            var sw = new Stopwatch();

            sw.Start();

            var input  = new string[] { clientInput.Base64String };
            var result = _watsonSpeechToTextService.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> WatsonTranslate([FromBody] ClientTranslationInput clientInput)
        {
            var       input = new string[] { clientInput.Base64String };
            Stopwatch sw    = new Stopwatch();

            sw.Start();

            SpeechRecognitionResult textResult = _watsonSpeechToTextService.ParseSpeectToText(input);

            string detectedText = "";

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

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

            TextTranslationResult result = await Task.Run(() => _watsonTextTranslationService.TranslateText(detectedText, clientInput.InputLanguage, 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));
        }