serialize all database operations by deferring them to the main thread