Replaced logic with built-in model.patches utilities.