placed functionalities of model post into a controller