in the UoW we have a private method ``getDocumentState()`` which more or less has this logic. maybe we should make it public?