Very messy beginnings of refactor on database services layer.
API refactor continues

Need to get views and client JS using the new db services / API respectively.
Change names of some errors.
Fix some formatting and comments in db services.
New test suite for database services.
Cleanup some problems in API.
Change status code ofr JSON parse failiure.
Rewrite API tests for new API.
Minor naming correction.
Merge branch 'database-refactor'