Add database abstraction module
Use new database API for initial queries
Use new database API for purging queries
Use new database API for purging queries
Use new database API for data retrieval queries
Use new database API for override methods
Use new database API for event and message logging
Properly use new API for inserting new user settings
Resolve a few mistakes
Add Database.commit method
Merge branch 'feature/db-abstraction' into develop