move db operations into a goroutine