move form logic to form controller