/**
  * Create token and translation (if not present)
  *
  * @param type $message
  * @param type $catalogue
  */
 protected function createTokenAndMessageForLocale($message, $languageEntity, $catalogue)
 {
     // this gets invoked to make sure the catalogue file is present
     $this->setupLanguageFile($catalogue, $languageEntity);
     $this->messages[] = $message;
     $token = $this->orm->getRepository('RaindropTranslationBundle:LanguageToken')->findOneByToken($message);
     if (!$token) {
         $token = new LanguageToken();
         $token->setToken($message);
         $this->orm->persist($token);
     }
     $translation = $this->orm->getRepository('RaindropTranslationBundle:LanguageTranslation')->findByLanguageAndTokenAndCatalogue($languageEntity->getLocale(), $message, $catalogue);
     if (!$translation) {
         $translation = new LanguageTranslation();
         $translation->setLanguage($languageEntity);
         $translation->setLanguageToken($token);
         $translation->setCatalogue($catalogue);
     }
     $this->orm->persist($translation);
     $this->orm->flush();
 }
 /**
  *
  * @param  type                $token
  * @param  type                $languageEntity
  * @param  type                $catalogue
  * @return LanguageTranslation
  */
 protected function getTranslation($token, $languageEntity, $catalogue)
 {
     $translation = $this->orm->getRepository('RaindropTranslationBundle:LanguageTranslation')->findByLanguageAndTokenAndCatalogue($languageEntity, $token, $catalogue);
     if (!$translation) {
         $translation = new LanguageTranslation();
         $translation->setLanguage($languageEntity);
         $translation->setLanguageToken($token);
         $translation->setCatalogue($catalogue);
         $this->orm->persist($translation);
         $this->orm->flush();
     }
     return $translation;
 }