protected function checkState()
{
if ($this->isDirty()) {
$this->refresh($this->keepChanges);
// check whether node|property updated state
if ($this->isDirty()) {
$this->setState($this->postDirtyState);
}
$this->keepChanges = false;
$this->postDirtyState = -1;
}
if ($this->state === self::STATE_DELETED) {
throw new InvalidItemStateException('Item ' . $this->path . ' is deleted');
}
// For all the other cases, the state does not change
}