public PostContent ToPostContent()
        {
            var pc = new PostContent(Text);

            if (!string.IsNullOrEmpty(Tags))
            {
                pc.SetTag(Tags);
            }

            if (!string.IsNullOrEmpty(ImagePath))
            {
                byte[] bytes = File.ReadAllBytes(ImagePath);
                pc.AddImage(bytes, ImagePath);
            }

            return(pc);
        }
        private async void Post()
        {
            try
            {
                string tmp = Utilities.ReplaceNewLines(Text);
                if (string.IsNullOrEmpty(tmp) || tmp.Length < 5)
                {
                    throw new Exception("Rant or comment must be more than 5 characters long.");
                }

                PostContent data = new PostContent(tmp);

                if (type == EditPostWindow.Type.Rant && !string.IsNullOrEmpty(TagsString))
                {
                    data.SetTag(TagsString);
                }

                if (!string.IsNullOrEmpty(ImagePath))
                {
                    byte[] bytes = File.ReadAllBytes(ImagePath);
                    data.AddImage(bytes, ImagePath);
                }

                window.IsEnabled = false;

                if (type == EditPostWindow.Type.Rant)
                {
                    if (editing != null)
                    {
                        api.User.EditRant(editing.AsRant().ID, data);
                    }
                    else
                    {
                        await api.User.PostRant(data);
                    }

                    if (existing != null)
                    {
                        db.RemoveDraft(existing.ID.Value);
                    }
                }
                else if (type == EditPostWindow.Type.Comment)
                {
                    if (editing != null)
                    {
                        api.User.EditComment(editing.AsComment().ID, data);
                    }
                    else
                    {
                        await api.User.PostComment(parent.RantId, data);
                    }
                }

                Cancelled = false;
                window.Close();
            }
            catch (Exception e)
            {
                MessageBoxFactory.ShowError(e, owner: window);
            }
            finally
            {
                window.IsEnabled = true;
            }
        }