My Solution

My approach aims to reduce the code in the controller and refactor it so that most functions have a single responsibility and it becomes reusable and _testable_. I fully expect it not to work, in fact I haven't even run it as I don't think that's the point of the exercise.

There are a number of ways I feel that both this solution and the project could improve on:
*   This solution could split the tasks of generating drop down arrays and generating queries into two seperate classes.
* The project, presumably, should consider if the use of Session variables is appropriate. If it is, then a more programmtic way of accessing keys should be considered.