Refactor models related to submissions

Group attribute constraints and update many of the queries.
Merge pull request #1691 from ferrous26/finders3

Refactor models related to submissions