/**
  * Up votes the given answer, if permitted for the given $userId
  * @param string $userId
  * @param string $projectId
  * @param string $questionId
  * @param string $answerId
  * @return array
  */
 public static function voteUp($userId, $projectId, $questionId, $answerId)
 {
     $projectModel = new ProjectModel($projectId);
     ProjectCommands::checkIfArchivedAndThrow($projectModel);
     $questionModel = new QuestionModel($projectModel, $questionId);
     // Check the vote lock.
     $vote = new UserVoteModel($userId, $projectId, $questionId);
     if ($vote->hasVote($answerId)) {
         // Don't throw.  There's no harm in this, just don't increment the vote.
         return self::encodeAnswer($questionModel->readAnswer($answerId));
     }
     // If ok up vote the question and add the lock.
     $answerModel = $questionModel->readAnswer($answerId);
     $answerModel->score++;
     $questionModel->writeAnswer($answerModel);
     $vote->addVote($answerId);
     $vote->write();
     ActivityCommands::updateScore($projectModel, $questionId, $answerId, $userId);
     // Return the answer dto.
     return self::encodeAnswer($answerModel);
 }