Extracted buildResourceName method