remove db entry first, wait for the write completion