add undo all function using NSCopying