Refactor resources to be db driven