moves generate method into controller and uses sessions