Welcome to the discussion board @abdashaffan,
What would happen when two users open a document at the same time and delete their local state once they sync with the other client?
Unless you implement some voting algorithm, there is no way to tell who should delete the content.
There is a relevant discussion to this problem here: Initial offline value of a shared document
Hope that helps. Cheers,
Kevin