/// <summary>
        /// Returns the approval status identifier for the supplied <see cref="BlogMLApprovalStatus"/>.
        /// </summary>
        /// <param name="status">The <see cref="BlogMLApprovalStatus"/> to get the text construct identifier for.</param>
        /// <returns>The approval status identifier for the supplied <paramref name="type"/>, otherwise returns an empty string.</returns>
        public static string ApprovalStatusAsString(BlogMLApprovalStatus status)
        {
            string name = String.Empty;

            foreach (System.Reflection.FieldInfo fieldInfo in typeof(BlogMLApprovalStatus).GetFields())
            {
                if (fieldInfo.FieldType == typeof(BlogMLApprovalStatus))
                {
                    BlogMLApprovalStatus approvalStatus = (BlogMLApprovalStatus)Enum.Parse(fieldInfo.FieldType, fieldInfo.Name);

                    if (approvalStatus == status)
                    {
                        object[] customAttributes = fieldInfo.GetCustomAttributes(typeof(EnumerationMetadataAttribute), false);

                        if (customAttributes != null && customAttributes.Length > 0)
                        {
                            EnumerationMetadataAttribute enumerationMetadata = customAttributes[0] as EnumerationMetadataAttribute;

                            name = enumerationMetadata.AlternateValue;
                            break;
                        }
                    }
                }
            }

            return(name);
        }
        /// <summary>
        /// Returns the <see cref="BlogMLApprovalStatus"/> enumeration value that corresponds to the specified approval status value.
        /// </summary>
        /// <param name="value">The value of the approval status identifier.</param>
        /// <returns>A <see cref="BlogMLApprovalStatus"/> enumeration value that corresponds to the specified string, otherwise returns <b>BlogMLApprovalStatus.None</b>.</returns>
        /// <remarks>This method disregards case of specified approval status value.</remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="name"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="name"/> is an empty string.</exception>
        public static BlogMLApprovalStatus ApprovalStatusByValue(string value)
        {
            BlogMLApprovalStatus approvalStatus = BlogMLApprovalStatus.None;

            Guard.ArgumentNotNullOrEmptyString(value, "value");
            foreach (System.Reflection.FieldInfo fieldInfo in typeof(BlogMLApprovalStatus).GetFields())
            {
                if (fieldInfo.FieldType == typeof(BlogMLApprovalStatus))
                {
                    BlogMLApprovalStatus status           = (BlogMLApprovalStatus)Enum.Parse(fieldInfo.FieldType, fieldInfo.Name);
                    object[]             customAttributes = fieldInfo.GetCustomAttributes(typeof(EnumerationMetadataAttribute), false);

                    if (customAttributes != null && customAttributes.Length > 0)
                    {
                        EnumerationMetadataAttribute enumerationMetadata = customAttributes[0] as EnumerationMetadataAttribute;

                        if (String.Compare(value, enumerationMetadata.AlternateValue, StringComparison.OrdinalIgnoreCase) == 0)
                        {
                            approvalStatus = status;
                            break;
                        }
                    }
                }
            }

            return(approvalStatus);
        }
        /// <summary>
        /// Modifies the <see cref="IBlogMLCommonObject"/> to match the data source.
        /// </summary>
        /// <param name="target">The object that implements the <see cref="IBlogMLCommonObject"/> interface to be filled.</param>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract BlogML common object information from.</param>
        /// <param name="settings">The <see cref="SyndicationResourceLoadSettings"/> used to configure the fill operation.</param>
        /// <returns><b>true</b> if the <paramref name="target"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="target"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="settings"/> is a null reference (Nothing in Visual Basic).</exception>
        public static bool FillCommonObject(IBlogMLCommonObject target, XPathNavigator source, SyndicationResourceLoadSettings settings)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(target, "target");
            Guard.ArgumentNotNull(source, "source");
            Guard.ArgumentNotNull(settings, "settings");
            XmlNamespaceManager manager = BlogMLUtility.CreateNamespaceManager(source.NameTable);

            if (source.HasAttributes)
            {
                string idAttribute           = source.GetAttribute("id", String.Empty);
                string dateCreatedAttribute  = source.GetAttribute("date-created", String.Empty);
                string dateModifiedAttribute = source.GetAttribute("date-modified", String.Empty);
                string approvedAttribute     = source.GetAttribute("approved", String.Empty);

                if (!String.IsNullOrEmpty(idAttribute))
                {
                    target.Id = idAttribute;
                    wasLoaded = true;
                }

                if (!String.IsNullOrEmpty(dateCreatedAttribute))
                {
                    DateTime createdOn;
                    if (SyndicationDateTimeUtility.TryParseRfc3339DateTime(dateCreatedAttribute, out createdOn))
                    {
                        target.CreatedOn = createdOn;
                        wasLoaded        = true;
                    }
                    else if (DateTime.TryParse(dateCreatedAttribute, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out createdOn))
                    {
                        target.CreatedOn = createdOn;
                        wasLoaded        = true;
                    }
                }

                if (!String.IsNullOrEmpty(dateModifiedAttribute))
                {
                    DateTime modifiedOn;
                    if (SyndicationDateTimeUtility.TryParseRfc3339DateTime(dateModifiedAttribute, out modifiedOn))
                    {
                        target.LastModifiedOn = modifiedOn;
                        wasLoaded             = true;
                    }
                    else if (DateTime.TryParse(dateModifiedAttribute, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out modifiedOn))
                    {
                        target.LastModifiedOn = modifiedOn;
                        wasLoaded             = true;
                    }
                }

                if (!String.IsNullOrEmpty(approvedAttribute))
                {
                    BlogMLApprovalStatus status = BlogMLUtility.ApprovalStatusByValue(approvedAttribute);
                    if (status != BlogMLApprovalStatus.None)
                    {
                        target.ApprovalStatus = status;
                        wasLoaded             = true;
                    }
                }
            }

            if (source.HasChildren)
            {
                XPathNavigator titleNavigator = source.SelectSingleNode("blog:title", manager);
                if (titleNavigator != null)
                {
                    BlogMLTextConstruct title = new BlogMLTextConstruct();
                    if (title.Load(titleNavigator, settings))
                    {
                        target.Title = title;
                        wasLoaded    = true;
                    }
                }
            }

            return(wasLoaded);
        }