@Transactional
  public Result removeProblem(long contestId, long contestProblemId)
      throws ContestNotFoundException, ContestProblemNotFoundException {
    Contest contest = contestService.findContestById(contestId);
    ContestProblem contestProblem = contestProblemService.findContestProblemById(contestProblemId);
    if (contest.isLocked()
        || !ContestControllerUtils.getInstance()
            .isManagerOrAbove(contest, IdentityUtils.getUserJid())
        || !contestProblem.getContestJid().equals(contest.getJid())) {
      return ContestControllerUtils.getInstance()
          .tryEnteringContest(contest, IdentityUtils.getUserJid());
    }

    contestProblemService.deleteContestProblem(contestProblem.getId());

    UrielControllerUtils.getInstance()
        .addActivityLog(
            BasicActivityKeys.REMOVE_FROM.construct(
                CONTEST,
                contest.getJid(),
                contest.getName(),
                PROBLEM,
                contestProblem.getProblemJid(),
                SandalphonResourceDisplayNameUtils.parseSlugByLanguage(
                    JidCacheServiceImpl.getInstance()
                        .getDisplayName(contestProblem.getProblemJid()))));

    return redirect(routes.ContestProblemController.viewProblems(contest.getId()));
  }
  @Transactional
  @RequireCSRFCheck
  public Result postEditProblem(long contestId, long contestProblemId)
      throws ContestNotFoundException, ContestProblemNotFoundException {
    Contest contest = contestService.findContestById(contestId);
    ContestProblem contestProblem = contestProblemService.findContestProblemById(contestProblemId);
    if (contest.isLocked()
        || !isAllowedToSuperviseProblems(contest)
        || !contestProblem.getContestJid().equals(contest.getJid())) {
      return ContestControllerUtils.getInstance()
          .tryEnteringContest(contest, IdentityUtils.getUserJid());
    }

    Form<ContestProblemEditForm> contestProblemEditForm =
        Form.form(ContestProblemEditForm.class).bindFromRequest();

    if (formHasErrors(contestProblemEditForm)) {
      return showEditProblem(contestProblemEditForm, contest, contestProblem);
    }

    ContestProblemEditForm contestProblemEditData = contestProblemEditForm.get();
    contestProblemService.updateContestProblem(
        contestProblem.getId(),
        contestProblemEditData.alias,
        contestProblemEditData.submissionsLimit,
        ContestProblemStatus.valueOf(contestProblemEditData.status),
        IdentityUtils.getUserJid(),
        IdentityUtils.getIpAddress());

    UrielControllerUtils.getInstance()
        .addActivityLog(
            BasicActivityKeys.EDIT_IN.construct(
                CONTEST,
                contest.getJid(),
                contest.getName(),
                PROBLEM,
                contestProblem.getProblemJid(),
                SandalphonResourceDisplayNameUtils.parseSlugByLanguage(
                    JidCacheServiceImpl.getInstance()
                        .getDisplayName(contestProblem.getProblemJid()))));

    return redirect(routes.ContestProblemController.viewProblems(contest.getId()));
  }