adds retain method to EntityState