public ActionResult Edit(Comment comment)
        {
            if (ModelState.IsValid)
            {
                this.commentRepository.InsertOrUpdate(comment);
                this.commentRepository.Save();
                return RedirectToAction("Index");
            }

            this.ViewBag.PossiblePages = this.pageRepository.All;
            return this.View();
        }
 public void InsertOrUpdate(Comment comment)
 {
     if (comment.CommentId == default(int))
     {
         // New entity
         this.context.Comments.Add(comment);
     }
     else
     {
         // Existing entity
         this.context.Entry(comment).State = EntityState.Modified;
     }
 }