Bunch of changes to make writing to DB easier.
Merge branch 'dev' of github.com:calpath/scenario-editor into dev