public function parseMovieVenues($id, $venues) { foreach ($venues->children() as $venue_element) { $venue = new Venue(); $venue->setVenue($venue_element, $id); if ($venue->exists()) { if ($venue->requiresUpdate()) { $venue->update(); } } else { $venue->insert(); } } }