private Node addObjectMember(
            String part,
            boolean isLast,
            ObjectNode container,
            Node value,
            int partPosition,
            boolean intermediate
    ) {
        if (isLast) {
            return container.withMember(part, value);
        } else if (container.getMember(part).isPresent()) {
            // Found the member, grab it, traverse into it, and update it.
            Node member = container.expectMember(part);
            Node updatedMember = addValue(member, value, partPosition + 1, intermediate);
            return container.withMember(part, updatedMember);
        } else if (intermediate) {
            // When creating intermediate values, generate a new object and
            // continue to traverse into it.
            Node synthesized = addValue(Node.objectNode(), value, partPosition + 1, intermediate);
            return container.withMember(part, synthesized);
        } else {
            LOGGER.warning(() -> String.format(
                    "Attempted to add a value through JSON pointer `%s`, but `%s` could not be found in %s",
                    toString(),
                    part,
                    Node.printJson(container)));
            return container;
        }
    }
Adds or replaces a {@code value} in {@code container} at the
JSON pointer location.

<p>When the JSON pointer is "", the entire document is replaced with the
given {@code value}. "-" can be used to access the last element of an array
or to add an element to the end of an array. Unlike {@link #addValue(Node, Node)},
attempting to add a property to a non-existent object will create a
new object and continue adding to the created result.

@param container Node to update.
@param value Value to update or replace.
@return Returns a representation of {@code container} with the updated value.
smithy-model/src/main/java/software/amazon/smithy/model/node/NodePointer.java