public ActionResult Add(PostViewModel post)
 {
     if (ModelState.IsValid)
     {
         post.IsPublished = true;
         post.UserId = User.Identity.GetUserId();
         for (int i = 0; i < post.Chapters.Count; i++)
         {
             post.Chapters[i].OrderNumber = i + 1;
         }
         var dbPost = Mapper.Map<Post>(post);
         dbPost.Tags = postService.GetTags(post.TagsString).ToList();
         dbPost.LastUpdateDate = DateTime.Now;
         postService.Create(dbPost);
         return RedirectToAction("Show", "Post", new {id = dbPost.Id});
     }
     return View(post);
 }
 public ActionResult Edit(PostViewModel post)
 {
     if (ModelState.IsValid && post.UserId == User.Identity.GetUserId())
     {
         var dbPost = Mapper.Map<Post>(post);
         dbPost.Tags = postService.GetTags(post.TagsString).ToList();
         postService.Update(dbPost);
         return RedirectToAction("Show", "Post", new {id = post.Id});
     }
     return View(post);
 }