public static bool Authorize(SlickBlogAppContext _db, Blog blog)
 {
     Guid userGuid = (Guid)Membership.GetUser().ProviderUserKey;
     UserInfo userInfo = _db.UserInfo.Single(ui => ui.UserGuid == userGuid);
     if (blog.Owner.Equals(userInfo))
     {
         return true;
     }
     return false;
 }
 public static IEnumerable<Post> getPagedPosts(Blog blog, int skip, int take, string scope)
 {
     bool publish;
     if (skip != 0)
     {
         skip--;
     }
     switch (scope)
     {
         case "published":
             {
                 publish = true;
                 break;
             }
         case "draft":
             {
                 publish = false;
                 break;
             }
         default:
             {
                 return blog.Posts.OrderByDescending(p => p.PostDate).Skip(skip * take).Take(take);
             }
     }
     return blog.Posts.Where(p => p.Published == publish).OrderByDescending(p => p.PostDate).Skip(skip * take).Take(take);
 }
 public static IEnumerable<Comment> getPagedComments(Blog blog, int skip, int take)
 {
     if (skip != 0)
     {
         skip--;
     }
     SlickBlogAppContext _db = new SlickBlogAppContext();
     IEnumerable<Comment> trl =  _db.Comments.Include("Author").Include("Post").Where(c => c.Post.Blog.Address.Equals(blog.Address)).OrderByDescending(c => c.PostDate).Skip(skip * take).Take(take);
     return trl;
 }