Refactored getResourceIds method.