refactor resource repository