Added post validation and refactoring in topic controller