code: String getSpaceIdOrThrow(CMAResource resource, String param) {
      final String spaceId = resource.getSpaceId();
      if (spaceId == null) {
        throw new IllegalArgumentException(String.format(
            "%s must have a space associated.", param));
      }
      return spaceId;
    }
docs: Extracts the Space ID from the given {@code resource} of name {@code param}.
  Throws {@link IllegalArgumentException} if the value is not present.