@Override
  public Page<ModelOutput> findByStudentIdAndCourseId(
      String studentId, String courseId, boolean onlyLastRun, Pageable pageable) {

    Page<ModelOutput> page = null;
    if (onlyLastRun) {
      RiskConfidence riskConfidence =
          riskConfidenceRepository.findTopByCourseIdOrderByDateCreatedDesc(courseId);
      if (riskConfidence != null) {
        page =
            convert(
                riskConfidenceRepository.findTopByCourseIdAndAlternativeIdOrderByDateCreatedDesc(
                    courseId, studentId, pageable),
                pageable);
      }
    } else {
      page =
          convert(
              riskConfidenceRepository.findByAlternativeIdAndCourseId(
                  studentId, courseId, pageable),
              pageable);
    }

    return page;
  }
 @Override
 public ModelOutput save(ModelOutput persistentLAPEntity) {
   RiskConfidence riskConfidence = toRiskConfidence((ModelOutput) persistentLAPEntity);
   RiskConfidence savedRiskConfidence = riskConfidenceRepository.save(riskConfidence);
   // nothing to change
   return fromRiskConfidence(savedRiskConfidence);
 }
  @Override
  public List<ModelOutput> saveAll(Collection<ModelOutput> persistentLAPentities) {
    if (persistentLAPentities != null && !persistentLAPentities.isEmpty()) {
      List<RiskConfidence> riskConfidenceEntities = new ArrayList<RiskConfidence>();
      for (PersistentLAPEntity persistentLAPEntity : persistentLAPentities) {
        RiskConfidence riskConfidence = toRiskConfidence((ModelOutput) persistentLAPEntity);
        riskConfidenceEntities.add(riskConfidence);
      }

      List<RiskConfidence> savedRiskConfidenceEntities =
          riskConfidenceRepository.save(riskConfidenceEntities);
      List<ModelOutput> modelOutputEntities = new ArrayList<ModelOutput>();
      for (RiskConfidence riskConfidence : savedRiskConfidenceEntities) {
        modelOutputEntities.add(fromRiskConfidence(riskConfidence));
      }

      return modelOutputEntities;
    }
    return null;
  }
 @Override
 public Page<ModelOutput> findByStudentId(String studentId, Pageable pageable) {
   return convert(riskConfidenceRepository.findByAlternativeId(studentId, pageable), pageable);
 }
 @Override
 public Page<ModelOutput> findAll(Pageable pageable) {
   return convert(riskConfidenceRepository.findAll(pageable), pageable);
 }