/// <summary>
        ///     Creates a schema definition.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>
        ///     New instance of schema definition.
        /// </returns>
        /// <exception cref="System.ArgumentNullException">Thrown when <paramref name="type"/> parameter is null.</exception>
        internal TypeSchema BuildSchema(Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            AvroContractResolver resolver = this.settings.Resolver;

            this.knownTypes.UnionWith(resolver.GetKnownTypes(type) ?? new List <Type>());
            return(this.CreateSchema(false, type, new Dictionary <string, NamedSchema>(), 0));
        }