Added sorting of change.added to avoid adding children before the parent is added
Check if a deleted element already has been deleted before deleting it