Segregate database reads/writes

- [x] Segregate reads/writes when executing database operations.
- [x] Allow for dirty reads using explicit method call InTransactionRawQuery.
- [x] Make RunInTransaction execution serialised. 
- [x] Switch to calling RunInTransaction instead of manually starting transactions to avoid interleaved/nested transactions.

Addresses issue #348