CoreObject getEntity and  removeEntity updated so that the entity to be removed is explicitly defined by getEntity