Iterating should be faster. I will refactor it into a loop. Also, would it be worth putting these kind of functions in some utils file in shared?