It almost feels like some built-in array function can do this - maybe I am wrong or maybe I am just not seeing it anymore.
This gateway is kicking my ass.