put db accesses into background thread.