move db relative code to background and call sendRequest in front