Added logic to handle entities that are only in cache