@GET
  @Path("/api/sessions/{id}")
  public RestSession getSession(@PathParam("id") long id) throws ResourceNotFoundException {
    StoredSessionWithLastAttempt session = sm.getSessionStore(getSiteId()).getSessionById(id);

    StoredProject proj = rm.getProjectStore(getSiteId()).getProjectById(session.getProjectId());

    return RestModels.session(session, proj.getName());
  }
  @GET
  @Path("/api/sessions")
  public RestSessionCollection getSessions(@QueryParam("last_id") Long lastId)
      throws ResourceNotFoundException {
    ProjectStore rs = rm.getProjectStore(getSiteId());
    SessionStore ss = sm.getSessionStore(getSiteId());

    List<StoredSessionWithLastAttempt> sessions =
        ss.getSessions(100, Optional.fromNullable(lastId));

    return RestModels.sessionCollection(rs, sessions);
  }
  @GET
  @Path("/api/sessions/{id}/attempts")
  public RestSessionAttemptCollection getSessionAttempts(
      @PathParam("id") long id, @QueryParam("last_id") Long lastId)
      throws ResourceNotFoundException {

    ProjectStore rs = rm.getProjectStore(getSiteId());
    SessionStore ss = sm.getSessionStore(getSiteId());

    StoredSession session = ss.getSessionById(id);
    StoredProject project = rs.getProjectById(session.getProjectId());
    List<StoredSessionAttempt> attempts =
        ss.getAttemptsOfSession(id, 100, Optional.fromNullable(lastId));

    List<RestSessionAttempt> collection =
        attempts
            .stream()
            .map(attempt -> RestModels.attempt(session, attempt, project.getName()))
            .collect(Collectors.toList());

    return RestModels.attemptCollection(collection);
  }