public int newPage(string blog_id, string username, string password, Page content, bool publish)
        {
            this.ValidateUser(username, password);

            int data = this.ProcessPageData(blog_id, username, password, content, null);

            return data;
        }
        private int ProcessPageData(string blog_id, string username, string password, Page content, int? pageId)
        {
            string body = content.description;
            string title = HttpUtility.HtmlDecode(content.title);

            PageDto newPage = !pageId.HasValue || pageId.Value < 1
                                  ? new PageDto()
                                  : this.pageService.GetPageByKey(pageId.Value);

            // everything that pass through the metaweblog handler goes published by default
            newPage.Status = ItemStatus.Published;
            newPage.Title = title;
            newPage.Slug = content.wp_slug;
            newPage.Content = body;
            newPage.Excerpt = (!string.IsNullOrEmpty(content.description))
                                  ? content.description.CleanHtmlText().Trim().Replace("&nbsp;", string.Empty).Cut(250)
                                  : string.Empty;
            if (newPage.IsTransient)
            {
                newPage.PublishAt = (content.dateCreated == DateTime.MinValue || content.dateCreated == DateTime.MaxValue)
                                        ? DateTimeOffset.Now
                                        : new DateTime(content.dateCreated.Ticks, DateTimeKind.Utc);
            }
            else
            {
                newPage.PublishAt = (content.dateCreated == DateTime.MinValue || content.dateCreated == DateTime.MaxValue)
                                        ? newPage.PublishAt
                                        : new DateTime(content.dateCreated.Ticks, DateTimeKind.Utc);
            }

            //TODO: add parent page

            //int order;
            //int.TryParse(content.wp_page_order, out order);
            ////nwPage.SortOrder = order;

            //int parentId;
            //if (int.TryParse(content.wp_page_parent_id, out parentId))
            //{
            //	if (parentId > 0)
            //	{
            //		var parentPage = pageService.GetPageByKey(parentId);
            //		nwPage.Parent = parentPage;
            //	}
            //}

            this.ConvertAllowCommentsForItem(content.mt_allow_comments, newPage);

            // set the author if specified, otherwise use the user that is authenticated by wlw
            // once a post is done, only the 'poster' can modify it
            if (!string.IsNullOrEmpty(content.wp_author_id))
            {
                // get the list of members
                WpAuthor[] authors = this.WpGetAuthors(blog_id, username, password);
                int authorId = Convert.ToInt32(content.wp_author_id);
                string author = authors.First(a => a.user_id == authorId).user_login;
                newPage.Author = author;
            }
            else if (!string.IsNullOrEmpty(content.user_id))
            {
                // get the list of members
                WpAuthor[] authors = this.WpGetAuthors(blog_id, username, password);
                int authorId = Convert.ToInt32(content.user_id);
                string author = authors.First(a => a.user_id == authorId).user_login;
                newPage.Author = author;
            }
            else
            {
                newPage.Author = username;
            }

            this.pageService.SaveOrUpdate(newPage);

            // in the end we need to refresh the routes
            this.routingService.UpdateRoutes();

            return newPage.Id;
        }
        public int editPage(string blog_id, string page_id, string username, string password, Page content, bool publish)
        {
            this.ValidateUser(username, password);

            int data = this.ProcessPageData(blog_id, username, password, content, page_id.ToInt32(0));

            return data;
        }