public CommentResult InsertComment(Comment comment)
    {
        CommentResult cr = new CommentResult();

        CommentsTableAdapter adapter = new CommentsTableAdapter();
        comment.date = DateTime.UtcNow;
        Object obj = adapter.InsertComment(comment.messageID, comment.userID, comment.body, comment.date, comment.isPrivate);
        if (obj != null)
        {

            System.Web.HttpRuntime.Cache.Remove("Comments");
            System.Web.HttpRuntime.Cache.Remove("Messages");
            cr.Id =  Convert.ToInt32(obj);
            cr.Key = Encrypt(cr.Id.ToString() + ".fgG43$#", true).Replace('+', '$'); ;

        }

        return cr;
    }
    public List<Comment> GetCommentsByMessageID(int msgId, int userId, int timeZone = 0, int top = 0)
    {
        List<Comment> comments = new List<Comment>();
        CommentsTableAdapter adapter = new CommentsTableAdapter();

        PostAroundMeDataSet.CommentsDataTable dt = new PostAroundMeDataSet.CommentsDataTable();
        dt = adapter.GetCommentsByMessageID(msgId);

        comments = CommentsDtToList(dt, userId, timeZone);
        if (top > 0)
        {
            comments = comments.OrderByDescending(m => m.date).ToList().Take(top).OrderBy(m => m.date).ToList();
        }
        return comments;
    }
    public List<Comment> GetAllComments(int userId, int timeZone = 0)
    {
        List<Comment> comments = new List<Comment>();
        CommentsTableAdapter adapter = new CommentsTableAdapter();

        PostAroundMeDataSet.CommentsDataTable dt = new PostAroundMeDataSet.CommentsDataTable();

        if (System.Web.HttpRuntime.Cache["Comments"] == null)
        {
            dt = adapter.GetData();
            System.Web.HttpRuntime.Cache.Insert("Comments", dt, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(10));
        }
        else
        {
            dt = System.Web.HttpRuntime.Cache["Comments"] as PostAroundMeDataSet.CommentsDataTable;
        }

        comments = CommentsDtToList(dt, userId, timeZone);

        return comments;
    }
    public Comment GetCommentByID(int id)
    {
        Comment  comment = new  Comment();
        CommentsTableAdapter adapter = new CommentsTableAdapter();

        PostAroundMeDataSet.CommentsDataTable dt = new PostAroundMeDataSet.CommentsDataTable();
        dt = adapter.GetCommentByID(id);

        PostAroundMeDataSet.CommentsRow dr = dt.FirstOrDefault();

        comment = CommentTranslator(dr);

        return comment;
    }
    public int DeleteComment(int commentId, int userid)
    {
        Object obj;
        int res = 0;
        CommentsTableAdapter commentsAdapter = new CommentsTableAdapter();
        obj = commentsAdapter.DeleteCommentByID(commentId, userid);
        if (obj != null)
        {
            res = Convert.ToInt32(obj);
            System.Web.HttpRuntime.Cache.Remove("Comments");
        }

        return res;
    }