public Post GetPost(int id)
        {
            Post post = new Post
                            {
                                Title = string.Format("Post Number {0}", id),
                                Content = string.Format("This is the content of post {0}", id),
                                Id = id
                            };

            return post;
        }
        public ActionResult Edit(Post post)
        {
            if (String.IsNullOrEmpty(post.Title))
                ModelState.AddModelError("Title", "Title is required");

            if (ModelState.IsValid)
            {
                _model.UpdatePost(post);
                return RedirectToAction("Edit", new { PostID = post.Id });
            }
                

            var viewModel = new EditPostModel() { Post = post };
            return View(viewModel);
               
        }
 public void UpdatePost(Post oldPost)
 {
     Post post = GetPost(oldPost.Id);
     if(post!=null)
     {
         post.Title = oldPost.Title;
         post.Content = oldPost.Content;
     }
     else
     {
         posts.Add(new Post()
                       {
                           Id = oldPost.Id,
                           Title = oldPost.Title,
                           Content = oldPost.Content
                       });
     }
 }