The order on which the operations are applied can trigger constraints. So it is safer to first delete then write and finally create. issue6790 review43511002