public <T extends ToNode> ObjectNode withOptionalMember(String key, Optional<T> value) {
        return value.map(val -> withMember(key, val)).orElse(this);
    }
Adds a member to a new ObjectNode if the provided value is present.

@param key Key to set if value is present.
@param <T> Type of the value member to add.
@param value Value that may be present.
@return Returns an object with the optionally added member.
smithy-model/src/main/java/software/amazon/smithy/model/node/ObjectNode.java