private static void _SerializeValue(Utf8JsonWriter writer, Object value)
        {
            Guard.NotNull(writer, nameof(writer));
            Guard.NotNull(value, nameof(value));

            System.Diagnostics.Debug.Assert(!value.GetType().IsEnum, "gltf schema does not define a typed way of serializing enums");

            if (writer.TryWriteValue(value))
            {
                return;
            }

            if (value is JsonSerializable vgltf)
            {
                vgltf.Serialize(writer); return;
            }

            if (value is System.Collections.IDictionary dict)
            {
                if (dict.Count == 0)
                {
                    return;
                }

                writer.WriteStartObject();

                foreach (var key in dict.Keys)
                {
                    var val = dict[key];
                    if (val == null)
                    {
                        continue;
                    }

                    // if the value is a collection, we need to check if the collection is empty
                    // to prevent writing the key, without writing the value.
                    if (!(val is String || val is JsonSerializable))
                    {
                        if (val is System.Collections.IList xlist && xlist.Count == 0)
                        {
                            continue;
                        }
                        if (val is System.Collections.IDictionary xdict && xdict.Count == 0)
                        {
                            continue;
                        }
                    }

                    _SerializeProperty(writer, key.ToString(), val);
                }

                writer.WriteEndObject();

                return;
            }

            if (value is System.Collections.IList list)
            {
                if (list.Count == 0)
                {
                    return;
                }

                writer.WriteStartArray();

                foreach (var item in list)
                {
                    _SerializeValue(writer, item);
                }

                writer.WriteEndArray();

                return;
            }

            throw new NotImplementedException($"Serialization of {value.GetType().Name} types is not supported.");
        }