/**
  * Create Question.
  *
  * @param questionBean {@link QuestionBean}.
  * @param account {@link UserAccount}
  * @param questionPattern {@link QuestionPattern}
  * @throws EnMeExpcetion exception
  */
 public Question createQuestion(
     final QuestionBean questionBean,
     final UserAccount account,
     final QuestionPattern questionPattern)
     throws EnMeExpcetion {
   final Question question = new Question();
   try {
     question.setQuestion(questionBean.getQuestionName());
     question.setSlugQuestion(RestFullUtil.slugify(questionBean.getQuestionName()));
     question.setAccountQuestion(account.getAccount());
     question.setQidKey(MD5Utils.md5(RandomStringUtils.randomAlphanumeric(500)));
     question.setSharedQuestion(false);
     getQuestionDao().saveOrUpdate(question);
     //                for (final QuestionAnswerBean answerBean : questionBean.getListAnswers()) {
     //                    this.createQuestionAnswer(answerBean, question);
     //                }
   } catch (Exception e) {
     log.error(e);
     throw new EnMeExpcetion(e);
   }
   return question;
 }
  /**
   * Create {@link TweetPollSwitch}.
   *
   * @return {@link TweetPollSwitch}.
   */
  public TweetPollSwitch createTweetPollSwitch(
      final TweetPoll tweetPoll, final QuestionAnswer answer, final HttpServletRequest request) {
    final TweetPollSwitch tPollSwitch = new TweetPollSwitch();
    tPollSwitch.setAnswers(answer);
    tPollSwitch.setTweetPoll(tweetPoll);
    // FIXME: Verfy if it these code already exist.
    tPollSwitch.setCodeTweet(
        MD5Utils.shortMD5(Calendar.getInstance().getTimeInMillis() + answer.getAnswer()));
    tPollSwitch.setDateUpdated(Calendar.getInstance().getTime());

    // vote without domain
    final StringBuffer voteUrlWithoutDomain = new StringBuffer();
    voteUrlWithoutDomain.append(this.TWEETPOLL_VOTE);
    voteUrlWithoutDomain.append(tPollSwitch.getCodeTweet());
    tPollSwitch.setRelativeUrl(voteUrlWithoutDomain.toString());

    final StringBuffer completeDomain = new StringBuffer();
    if (request != null) {
      final String domain = WidgetUtil.getDomain(request);
      completeDomain.append(domain);
    }
    completeDomain.append(voteUrlWithoutDomain.toString());
    log.debug("tweet poll answer vote :{" + voteUrlWithoutDomain.toString());
    if (InternetUtils.validateUrl(completeDomain.toString())) {
      log.debug("createTweetPollSwitch: URL IS VALID");
      //			log.debug("createTweetPollSwitch: short url provider "+ answer.getProvider());
      tPollSwitch.setShortUrl(
          WidgetUtil.createShortUrl(answer.getProvider(), completeDomain.toString()));
    } else {
      log.debug("createTweetPollSwitch: url IS NOT valid");
      tPollSwitch.setShortUrl(completeDomain.toString());
      log.warn("Invalid format vote url:{" + voteUrlWithoutDomain.toString());
    }
    getTweetPollDao().saveOrUpdate(tPollSwitch);
    return tPollSwitch;
  }