private void ConsumeImport()
        {
            XmlReaderSettings settings = new XmlReaderSettings
            {
                IgnoreWhitespace = true
            };

            using XmlReader reader = XmlReader.Create(fileToImport, settings);
            while (reader.Read())
            {
                if (reader.IsStartElement())
                {
                    switch (reader.Name)
                    {
                    case "title":
                        blogName = reader.ReadElementContentAsString();
                        break;

                    case "description":
                        blogDescription = reader.ReadElementContentAsString();
                        break;

                    // TODO: refactor item, category and tag to remove repeated code
                    case "item":     // includes posts, pages, nav items and media
                        WordpressItem post = ParseItem(reader);
                        wordpressItems.Add(post);
                        break;

                    case "wp:category":
                        WordpressCategory category = ParseCategory(reader);
                        wordpressCategories.Add(category);
                        break;

                    case "wp:tag":
                        WordpressTag tag = ParseTag(reader);
                        wordpressTags.Add(tag);
                        break;

                    case "wp:author":
                    default:
                        //Console.WriteLine("Skipping node: {0}", reader.Name);
                        break;
                    }
                }
            }
        }
        private WordpressItem ParseItem(XmlReader itemReader)
        {
            WordpressItem post = new WordpressItem();

            while (!itemReader.EOF)
            {
                if (itemReader.IsStartElement())
                {
                    switch (itemReader.Name)
                    {
                    case "title":
                        post.Title = itemReader.ReadElementContentAsString();
                        break;

                    case "link":
                        post.Link = itemReader.ReadElementContentAsString();
                        break;

                    case "wp:post_date":
                        post.DatePublished = itemReader.ReadElementContentAsString();
                        break;

                    case "dc:creator":
                        post.CreatedByUsername = itemReader.ReadElementContentAsString();
                        break;

                    case "description":
                        post.Content = itemReader.ReadElementContentAsString();
                        break;

                    case "content:encoded":
                        post.Content = itemReader.ReadElementContentAsString();
                        break;

                    case "wp:post_id":
                        post.Id = itemReader.ReadElementContentAsLong();
                        break;

                    case "wp:status":
                        post.Status = itemReader.ReadElementContentAsString();
                        break;

                    case "wp:post_parent":
                        post.ParentId = itemReader.ReadElementContentAsLong();
                        break;

                    case "wp:post_type":
                        post.Type = itemReader.ReadElementContentAsString();
                        break;

                    case "wp:attachment_url":
                        post.AttachmentUrl = itemReader.ReadElementContentAsString();
                        break;

                    case "category":
                        if (itemReader.GetAttribute("domain") == "category")
                        {
                            post.AddCategory(itemReader.GetAttribute("nicename"));
                        }
                        else
                        {
                            post.AddTag(itemReader.GetAttribute("nicename"));
                        }
                        itemReader.Read();
                        break;

                    default:
                        itemReader.Read();
                        break;
                    }
                }
                else
                {
                    itemReader.Read();
                }
                if (itemReader.Name == "item" && itemReader.NodeType == XmlNodeType.EndElement)
                {
                    // reached end node of item
                    break;
                }
            }
            return(post);
        }