class QuestionPriorityOrderService {

    @Transactional
    @NotSecured("Must be secured by other services.")
    public Question prioritiseAssessedQuestionAfterCreation(Question createdQuestion) {
        Question assessedQuestionWithHighestPriority = questionRepository
                .findFirstByCompetitionIdAndSectionNameOrderByPriorityDesc(createdQuestion.getCompetition().getId(),
                        APPLICATION_QUESTIONS.getName());
        createdQuestion.setPriority(assessedQuestionWithHighestPriority.getPriority() + 1);

        Question questionSaved = questionRepository.save(createdQuestion);

        questionNumberOrderService.updateAssessedQuestionsNumbers(createdQuestion.getCompetition().getId());

        return questionSaved;
    }

}