The functionality above feels more like `appendAttribute` logic, not `addAttribute`, as the latter makes me think you're adding a new attribute, not updating an existing one.