public function getById($id): ?AbstractEntity
    {
        $entity = $this->getRepository()->findById($id);

        if ($entity instanceof AbstractEntity) {
            $this->prepareEntityForGet($entity);
        }

        return $entity;
    }