/// <summary>
        /// Create an instance of the JSON converter for the given type.
        /// </summary>
        /// <param name="type">The type to create the converter for.</param>
        /// <returns>The JSON converter for the given type.</returns>
        /// <remarks>This will always ensure that a converter is returned.</remarks>
        public IJsonConverter CreateInstance(Type type)
        {
            if (_defaultConverterFactory != null)
            {
                var converter = _defaultConverterFactory.CreateInstance(type);

                if (converter != null)
                {
                    return(converter);
                }
            }

            return(GetOrCreateInstance(type));
        }
            /// <summary>
            /// Serialize an inline object.
            /// </summary>
            /// <param name="value">The value to serialization inline.</param>
            /// <returns>The JSON value which represents the inline serialization of the value.</returns>
            public JsonValue SerializeValue(object value)
            {
                if (ReferenceEquals(value, null) || _visited.Contains(value))
                {
                    return(JsonNull.Instance);
                }

                var type      = value.GetType();
                var converter = _jsonConverterFactory.CreateInstance(type);

                if (converter == null)
                {
                    throw new InvalidOperationException($"No converter could be found for the type '{type}'.");
                }

                using (_visited.Visit(value))
                {
                    return(converter.SerializeValue(this, type, value));
                }
            }