Complete database operations in background thread.