Refactor EntityResolver