Renamed EntityStateManager to EntityRegistry, updated tests, reconfigured refreshCache() to be a little more intelligent