remove database call from inside the thread