private static object FromXml(Type targetType, XDocument document, XmlSerializationDefinition definition)
        {
            targetType.ThrowIfNull(nameof(targetType));
            document.ThrowIfNull(nameof(document));
            definition.ThrowIfNull(nameof(definition));

            // If the root element is null, then don't bother and return the default type.
            if (document.Root == null)
            {
                return(SerializationUtilities.GetDefaultValue(targetType));
            }

            return(Serializer.Deserialize(targetType, document.Root, definition));
        }