public void UpdateAnagramsCache(string word, List <WordModel> anagrams)
        {
            foreach (WordModel anagram in anagrams)
            {
                _dbContext.Add(new CachedWord()
                {
                    Word = word, AnagramWord = _dbContext.Words.SingleOrDefault(w => w.Id == anagram.Id)
                });
            }

            _dbContext.SaveChanges();
        }
 void IWordsRepository.AddNewWord(string word)
 {
     try
     {
         if (!_dbContext.Words.Any(w => w.WordValue == word))
         {
             Word newWord = new Word()
             {
                 WordValue = word
             };
             _dbContext.Add(newWord);
             _dbContext.SaveChanges();
         }
         else
         {
             throw new InvalidOperationException("Unable to add already existing word.");
         }
     }
     catch (InvalidOperationException ex)
     {
         throw;
     }
 }