public ServiceResponse<String> registerUser(RegisterModel model) {
    ServiceResponse<String> response = new ServiceResponse<>();
    response.setStatus(ServiceResponse.Status.SUCCESS);

    if (!userExists(model)) {
      response.setResult(userRepo.registerUser(model));
    } else {
      // user already exists
      response.setStatus(ServiceResponse.Status.FAIL);
      response.setMessage(ServiceResponse.Messages.USER_EXISTS);
    }

    return response;
  }
  @Override
  public ServiceResponse<UserLocation> updateUserLocation(String userId, UserLocation location) {
    location = userRepo.updateUserLocation(location, userId);

    ServiceResponse<UserLocation> serviceResponse = new ServiceResponse<>();
    if (location != null) {
      serviceResponse.setStatus(ServiceResponse.Status.SUCCESS);
      serviceResponse.setResult(location);
    } else {
      serviceResponse.setStatus(ServiceResponse.Status.FAIL);
      serviceResponse.setMessage(ServiceResponse.Messages.COULD_NOT_UPDATE_USER_LOCATION);
    }

    return serviceResponse;
  }
  @Override
  public ServiceResponse<String> addJourney(Journey journey, String userId) {
    ServiceResponse<String> response = new ServiceResponse<>();
    response.setStatus(ServiceResponse.Status.SUCCESS);

    if (userExists(userId)) {
      response.setResult(userRepo.addJourney(journey, userId));
    } else {
      // user doesn't exist
      response.setStatus(ServiceResponse.Status.FAIL);
      response.setMessage(ServiceResponse.Messages.USER_NOT_EXISTS);
    }

    return response;
  }
  @Override
  public ServiceResponse<JourneyUpdate> updateUserJourney(
      String userId, JourneyUpdate journeyUpdate, String journeyId) {
    journeyUpdate = userRepo.updateUserJourney(journeyUpdate, userId, journeyId);

    ServiceResponse<JourneyUpdate> serviceResponse = new ServiceResponse<>();
    if (journeyUpdate != null) {
      serviceResponse.setStatus(ServiceResponse.Status.SUCCESS);
      serviceResponse.setResult(journeyUpdate);
    } else {
      serviceResponse.setStatus(ServiceResponse.Status.FAIL);
      serviceResponse.setMessage(ServiceResponse.Messages.COULD_NOT_UPDATE_USER_LOCATION);
    }

    return serviceResponse;
  }
  /**
   * Don't modify this. Don't try to understand what this function does. It works, leave it as is.
   * If something breaks, verify query params (locationId, id, creationDate, etc) Increment hour
   * counter spent here : 5
   */
  @Override
  public ServiceResponse<JourneyResult> getJourneys(String userId) {
    String finalUserId = transformDbId(userId, appNamespace);
    String getUserJourneysQuery = getUsersJourney.replaceAll(":id:", finalUserId);

    ConcurrentMap<String, IRI> variableTypes = new ConcurrentHashMap<>();

    List<LDObject> journeyLocation = new ArrayList<>();
    List<LDObject> journeyData = new ArrayList<>();

    List<BindingSet> bindingSets = service.query(getUserJourneysQuery);

    bindingSets
        .stream()
        .forEach(
            bindings ->
                splitJourneyLocation(variableTypes, journeyLocation, journeyData, bindings));

    // add this to the other journey stuff
    List<LDObject> journeyLocations = mergeLocations(journeyLocation);
    List<LDObject> journeys = mergeJourneys(journeyData);

    List<JourneyData> finalR = new ArrayList<>();
    journeys
        .stream()
        .parallel()
        .forEach(journey -> mapJourneyLocation(journeyLocations, finalR, journey));

    ContextCreator creator = new ContextCreator();
    JourneyResult journeyResult = new JourneyResult();
    journeyResult.setContext(creator.create(getUserJourneysQuery, variableTypes));
    journeyResult.setItems(finalR);

    ServiceResponse<JourneyResult> serviceResponse = new ServiceResponse<>();
    serviceResponse.setStatus(ServiceResponse.Status.SUCCESS);
    serviceResponse.setResult(journeyResult);

    return serviceResponse;
  }