Refactoring public posts controller