Some refactoring on PostsController