public static void DestroyDeletedPost(int postid) { Post p = new Post(postid); // Check if post is featured in it's category before deletion Core.Category c = p.Category; if (p.Id == c.FeaturedId) { c.FeaturedId = 0; c.Save(); } // Check site featured post SiteSettings settings = SiteSettings.Get(); if (p.Id == settings.FeaturedId) { settings.FeaturedId = 0; settings.Save(); } PostStatistic.Destroy(PostStatistic.Columns.PostId, postid); Tag.Destroy(Tag.Columns.PostId, postid); Comment.Destroy(Comment.Columns.PostId, postid); DataService.ExecuteNonQuery(new QueryCommand("delete from graffiti_VersionStore where Type = 'post/xml' and ItemId = " + postid)); Post.Destroy(postid); DeletePostDirectory(p); }