protected function wrapTheseCollectionsAroundThisPage($collections, $page) { foreach ($collections as $key => $collection) { foreach ($collection as $fields) { foreach ($fields as $field) { $this->updateUrlsInField($field); } } $page->{$key} = $collection; } return $page; }