refactor post form and post methods in controller