public async Task <TranslationResult> TranslateAsync(string textToTranslate, string translationMethod) { _logger.Info($"textToTranslate: {textToTranslate}; translationMethod: {translationMethod}"); var result = new TranslationResult(); var strategy = _strategyFactory.CreateForMethod(translationMethod); if (string.IsNullOrWhiteSpace(textToTranslate)) { result.AddError("Text To Translate can't be null or empty"); } if (strategy == null) { result.AddError($"Translation method: {translationMethod} is not supported yet!"); } //When no validation errors, execute strategy if (result.IsSuccess) { result = await strategy.Execute(textToTranslate); } _logger.Info(JsonConvert.SerializeObject(result)); return(result); }