PostsController refactoring.
Merge pull request #1991 from velesin/posts_controller_refactoring

PostsController refactoring.