Complete database operations in a background thread.