protected function insureSingleEntity($entity, $referencesDefinition, $step)
    {
        $this->insureEntityCountCompatibility($entity, $referencesDefinition, $step);

        if ($entity instanceof AbstractCollection) {
            return reset($entity);
        }

        return $entity;
    }