code: Integer getVersionOrThrow(CMAResource resource, String action) {
      final Integer version = resource.getVersion();
      if (version == null) {
        throw new IllegalArgumentException(String.format(
            "Cannot perform %s action on a resource that has no version associated.",
            action));
      }
      return version;
    }
docs: Extracts the version number for the given {@code resource}.
  Throws {@link IllegalArgumentException} if the value is not present.