@SuppressWarnings("unchecked")
    Node serialize(Object object, Set<Object> serializedObject) {
        if (object == null) {
            return Node.nullNode();
        }

        // Iterate over the serializers in the correct order.
        for (Serializer serializer : serializers) {
            if (serializer.getType().isInstance(object)) {
                Node result = serializer.serialize(object, serializedObject, this);
                if (result != null) {
                    return result;
                }
            }
        }

        // Finally, attempt to serialize using bean conventions.
        return DefaultNodeSerializers.FROM_BEAN.serialize(object, serializedObject, this);
    }
Serializes the given {@code object} as a {@code Node}.

<p>This method is used when serializing values recursively from another serializer.

@param object Object to serialize.
@param serializedObject An identity set of objects that have already been serialized.
  This prevents infinite recursion on a self-referencing value.
@return Returns the serialized {@code Node}.
@throws NodeSerializationException on error.
smithy-model/src/main/java/software/amazon/smithy/model/node/NodeMapper.java