public async Task <ActionResult <Word> > UpdateWord(int wordId, [FromBody] SaveWordDto saveWordDto)
        {
            var validator        = new SaveWordDtoValidator();
            var validationResult = await validator.ValidateAsync(saveWordDto);

            if (!validationResult.IsValid)
            {
                foreach (ValidationFailure failure in validationResult.Errors)
                {
                    return(BadRequest(failure.ErrorMessage));
                }
            }

            var wordToupdate = await _wordService.GetWordById(wordId);

            if (wordToupdate == null)
            {
                return(NotFound());
            }

            var word = _mapper.Map <SaveWordDto, Word>(saveWordDto);

            await _wordService.UpdateWord(wordToupdate, word);

            var updatedWord = await _wordService.GetWordById(wordId);

            var updatedWordDto = _mapper.Map <Word, WordDto>(updatedWord);

            return(Ok(updatedWordDto));
        }
        public async Task <ActionResult <Word> > CreateWord(int vocabularyId, [FromBody] SaveWordDto saveWordDto)
        {
            saveWordDto.VocabularyId = vocabularyId;

            var validator        = new SaveWordDtoValidator();
            var validationResult = await validator.ValidateAsync(saveWordDto);

            if (!validationResult.IsValid)
            {
                foreach (ValidationFailure failure in validationResult.Errors)
                {
                    return(BadRequest(failure.ErrorMessage));
                }
            }

            var wordToCreate = _mapper.Map <SaveWordDto, Word>(saveWordDto);
            var newWord      = await _wordService.CreateWord(wordToCreate);

            var newWordDto = _mapper.Map <Word, WordDto>(newWord);

            return(Ok(newWordDto));
        }