docs: @SuppressWarnings( { "unchecked", "rawtypes" } )
      public static <T extends SchematicDb> T getDb(Document document, ClassLoader cl) throws RuntimeException {
          String type = document.getString(TYPE_FIELD);
          if (type == null) {
              throw new IllegalArgumentException("The configuration document '" + document + "' does not contain a '" + TYPE_FIELD + "' field");
          }
          ServiceLoader<SchematicDbProvider> providers = ServiceLoader.load(SchematicDbProvider.class, cl);
          List<RuntimeException> raisedExceptions = new ArrayList<>();
          return (T) StreamSupport.stream(providers.spliterator(), false)
                                  .map(provider -> getDbFromProvider(type, document, raisedExceptions, provider))
                                  .filter(Objects::nonNull)
                                  .findFirst()
                                  .orElseThrow(() -> {
                                      if (!raisedExceptions.isEmpty()) {
                                          return raisedExceptions.get(0);
                                      } else {
                                          return new RuntimeException(
                                                  "None of the existing persistence providers could return a Schematic DB with type '" + type + "'");
                                      }
                                  });
      }