public TimeSeries<RaceObservationContext, Integer> getTimeSeries(
      String reference, ObservableType type) {

    RaceEventData data = documentStore.retrieve(reference);

    return data.getAsTimeSeries(type, true);
  }
  public void createRecord(RaceActivityRecordDTO record, RaceEventData data) {
    documentStore.store(data);
    record.setDataReference(data.getId());

    try {
      ResponseEntity<RaceActivityRecordDTO> response =
          restTemplate.postForEntity(analyticsUrl, record, RaceActivityRecordDTO.class);
      logger.info("Posted race activity record.");
      if (response.getStatusCode() != HttpStatus.CREATED) {
        logger.error(
            "HTTP Error: {}. Couldn't post race activity record.", response.getStatusCode());
      }
    } catch (Exception e) {
      logger.error(
          "Exception: {} {}. Couldn't post race activity record to {}.",
          e.getClass().getSimpleName(),
          e.getMessage(),
          analyticsUrl);
    }
  }