More details: if I change a new document after flush and call flush again the value of the protected property is still null and so it is tried to be removed. I have updated the ProtectedPropertyTest to show that behaviour if you ommit that if statement.