protected function isSameAsEntity(Entity $entity): bool
    {
        return
            $this === $entity ||
            (
                $this instanceof IdentifiableEntity &&
                $entity instanceof IdentifiableEntity &&
                get_class($this) === get_class($entity) &&
                $this->getId() === $entity->getId()
            );
    }