isolate form generation logic to form controller