[Change] Refactoring code to eliminate resource iteration code duplicates