refactoring resource into an enumerable object