if the key of the document is exist then replace it.
remove @try in remove document methods.