Reset document id after deletion only when there is a document