Could just cast `$models` to an array using `(array) $models` and eliminate some logic.