/// <summary>
        /// Converts the static entity.
        /// </summary>
        /// <param name="staticEntity">The static entity.</param>
        /// <returns></returns>
        private WpPostEntity ConvertStaticEntity(PhpStaticEntity staticEntity)
        {
            var excerpt = string.Empty;
            if (staticEntity.Content.Contains("<br />"))
            {
                excerpt = staticEntity.Content.Substring(0, staticEntity.Content.IndexOf("<br />"));
            }

            var postEntity = new WpPostEntity
            {
                ID = null,
                PostAuthor = 1,
                PostDate = staticEntity.DateConverted,
                PostDateGmt = staticEntity.DateConverted.ToUniversalTime(),
                PostContent = staticEntity.Content,
                PostTitle = staticEntity.Subject,
                PostExcerpt = excerpt,
                PostStatus = "publish",
                CommentStatus = "open",
                PingStatus = "open",
                PostPassword = string.Empty,
                PostName = staticEntity.Subject,
                ToPing = string.Empty,
                Pinged = string.Empty,
                PostModified = staticEntity.DateConverted,
                PostModifiedGmt = staticEntity.DateConverted.ToUniversalTime(),
                PostContentFiltered = string.Empty,
                PostParent = 0,
                Guid = Guid.NewGuid().ToString().ToUpper(),
                MenuOrder = 0,
                PostType = "page",
                PostMimeType = string.Empty,
                RelatedLink = string.Empty,
                CommentCount = 0
            };

            return postEntity;
        }
        /// <summary>
        /// Converts the Simple PHP Blog entity to a WordPress Post entity.
        /// </summary>
        /// <param name="blogEntity">The blog entity.</param>
        /// <returns></returns>
        private WpPostEntity ConvertBlogEntity(PhpBlogEntity blogEntity)
        {
            var excerpt = string.Empty;
            if (blogEntity.Content.Contains("<br />"))
            {
                excerpt = blogEntity.Content.Substring(0, blogEntity.Content.IndexOf("<br />"));
            }

            var postEntity = new WpPostEntity
                                 {
                                     ID = null,
                                     PostAuthor = 1,
                                     PostDate = blogEntity.DateConverted,
                                     PostDateGmt = blogEntity.DateConverted.ToUniversalTime(),
                                     PostContent = blogEntity.Content,
                                     PostTitle = blogEntity.Subject,
                                     PostExcerpt = excerpt,
                                     PostStatus = "publish",
                                     CommentStatus = "open",
                                     PingStatus = "open",
                                     PostPassword = string.Empty,
                                     PostName = blogEntity.Subject,
                                     ToPing = string.Empty,
                                     Pinged = string.Empty,
                                     PostModified = blogEntity.DateConverted,
                                     PostModifiedGmt = blogEntity.DateConverted.ToUniversalTime(),
                                     PostContentFiltered = string.Empty,
                                     PostParent = 0,
                                     Guid = Guid.NewGuid().ToString().ToUpper(),
                                     MenuOrder = 0,
                                     PostType = "post",
                                     PostMimeType = string.Empty,
                                     RelatedLink = blogEntity.RelatedLink,
                                     CommentCount = (blogEntity.Comments ?? new List<PhpCommentEntity>()).Count
                                 };
            // Comments
            if (blogEntity.Comments != null)
            {
                foreach (var c in blogEntity.Comments)
                {
                    if (postEntity.Comments == null)
                    {
                        postEntity.Comments = new List<WpCommentEntity>();
                    }
                    var comment = ConvertCommentEntity(c);

                    var commentEntity =
                        postEntity.Comments.Find(
                            item =>
                            item.Date == comment.Date && item.Author == comment.Author &&
                            item.Content == comment.Content);

                    if (commentEntity == null)
                    {
                        postEntity.Comments.Add(comment);
                    }
                }
            }

            // Categories
            var cats = new List<WpCategoryEntity>();

            if (blogEntity.CategoryList == null)
            {
                blogEntity.CategoryList = new List<PhpCategoryEntity>();
            }

            if (postEntity.Categories == null)
            {
                postEntity.Categories = new List<WpCategoryEntity>();
            }

            if (m_categories != null)
            {
                if (!string.IsNullOrEmpty(blogEntity.Categories))
                {
                    var categories = blogEntity.Categories.Split(',');
                    foreach (var category in categories)
                    {
                        var phpCategoryEntity = m_categories.Find(item => item.ID == category);
                        if (phpCategoryEntity != null)
                        {
                            var wpCategoryEntity = ConvertCategoryEntity(phpCategoryEntity);

                            var categoryEntity =
                                postEntity.Categories.Find(item => item.Description == wpCategoryEntity.Description);

                            if (categoryEntity == null)
                            {
                                cats.Add(wpCategoryEntity);
                            }
                            postEntity.Categories = cats;
                        }
                    }
                }
                else
                {
                    var phpCategoryEntity = m_categories.Find(item => item.Description == "General");
                    if (phpCategoryEntity != null)
                    {
                        var wpCategoryEntity = ConvertCategoryEntity(phpCategoryEntity);

                        var categoryEntity =
                            postEntity.Categories.Find(item => item.Description == wpCategoryEntity.Description);

                        if (categoryEntity == null)
                        {
                            cats.Add(wpCategoryEntity);
                        }
                        postEntity.Categories = cats;
                    }
                }
            }

            if (blogEntity.CategoryList != null && blogEntity.CategoryList.Count > 0)
            {
                postEntity.PostCategory = Convert.ToInt32(DefaultCategory);
            }
            else if (!string.IsNullOrEmpty(blogEntity.Categories))
            {
                if ((blogEntity.Categories ?? string.Empty).Contains(","))
                {
                    var categories = (blogEntity.Categories ?? string.Empty).Split(',');
                    postEntity.PostCategory = Convert.ToInt32(categories[0]);
                }
                else
                {
                    postEntity.PostCategory = Convert.ToInt32(blogEntity.Categories);
                    if (postEntity.PostCategory == 0)
                    {
                        postEntity.PostCategory = Convert.ToInt32(DefaultCategory);
                    }
                }
            }
            else
            {
                postEntity.PostCategory = Convert.ToInt32(DefaultCategory);
            }

            return postEntity;
        }