protected function getUncachedRelationCount($propertyName)
    {
        if ($this->$propertyName instanceof LazyObjectStorage) {
            $reflectionClass = new \ReflectionClass(LazyObjectStorage::class);
            $reflectionProperty = $reflectionClass->getProperty('fieldValue');
            $reflectionProperty->setAccessible(true);
            $count = (int)$reflectionProperty->getValue($this->$propertyName);
        } else {
            $count = $this->$propertyName->count();
        }

        return $count;
    }