protected void saveLeadersToDatabase(List<Leader> Leaders, Repository repository)
      throws JSONException {
    String json = convertLeadersToJson(Leaders).toString();

    String repoSlug = repository.getSlug();
    String projectKey = repository.getProject().getKey();
    pluginSettings.put(projectKey + "." + repoSlug + ".prInfo", json);
  }
  public Map<String, Object> getLeadersFromDatabase(
      Scoring scoring, Repository repository, String history) throws JSONException {
    // Get string from database for repo
    String repoLeaderboardString = "";
    Object repoLeaderboard =
        pluginSettings.get(
            repository.getProject().getKey() + "." + repository.getSlug() + ".prInfo");
    if (repoLeaderboard != null) {
      repoLeaderboardString = repoLeaderboard.toString();
    }

    // convert json to leaders
    List<Leader> leaders = convertJsonToLeaders(scoring, repoLeaderboardString);
    if (history != null) {
      for (Leader leader : leaders) {
        leader.setScore(history);
      }
      sortLeaders(leaders);
    }
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("leaders", leaders);
    return map;
  }