public QuestionUI addVote(String questionId, Principal principal) {
    QuestionUI result = new QuestionUI();
    User user = userRepo.findByUserName(principal.getName());

    Query q = new Query(Criteria.where("id").is(questionId));
    if (user != null) {
      Vote vote = new Vote();
      vote.setId(user.getId());
      vote.setUser(user.getUserName());
      vote.setCreatedDate(Calendar.getInstance().getTime());

      Update updateQ = new Update().set("votes." + user.getId(), vote);
      template.updateFirst(q, updateQ, Question.class);
    }

    result = qMapper.toUIBean(template.findOne(q, Question.class));
    return result;
  }
  public QuestionUI addBookmark(String questionId, Principal principal) {
    QuestionUI result = new QuestionUI();
    User user = userRepo.findByUserName(principal.getName());

    Query q = new Query(Criteria.where("id").is(questionId));
    if (user != null) {
      Bookmark bookmark = new Bookmark();
      bookmark.setId(user.getId());
      bookmark.setUser(user.getUserName());
      bookmark.setQuestionId(questionId);
      bookmark.setCreatedDate(Calendar.getInstance().getTime());

      template.updateFirst(
          new Query(Criteria.where("id").is(user.getId())),
          new Update().set("bookmarks." + questionId, bookmark),
          User.class);

      Update updateQ = new Update().set("bookmarks." + user.getId(), bookmark);
      template.updateFirst(q, updateQ, Question.class);
    }

    result = qMapper.toUIBean(template.findOne(q, Question.class));
    return result;
  }