public async Task <ActionResult <Ingredient> > AddAutocompletedIngredient(string name) { var ingredient = await _pubChemService.AutoComplete(new Ingredient { PolishName = name }); if (ingredient == null) { return(NotFound()); } await _ingredientService.AddRelationsToHazardStatements(ingredient.Id, ingredient.HazardStatements); var ing = await _ingredientRepository.Add(ingredient); ing.HazardStatements = ingredient.HazardStatements; return(ing); }