code: protected void trackServiceSession(final String id, final Service service, final boolean onlyTrackMostRecentSession) {
          update();
          service.setPrincipal(getRoot().getAuthentication().getPrincipal().getId());
          if (onlyTrackMostRecentSession) {
              val path = normalizePath(service);
              val existingServices = this.services.values();
              existingServices.stream().filter(existingService -> path.equals(normalizePath(existingService))).findFirst().ifPresent(existingServices::remove);
          }
          this.services.put(id, service);
      }
docs: Update service and track session.
  
  @param id                         the id
  @param service                    the service
  @param onlyTrackMostRecentSession the only track most recent session