refactoring add resource