public function countStored()
{
/** @var ICollection $collection */
$collection = $this->collection === null && !$this->toAdd && !$this->toRemove && !$this->added && !$this->removed && $this->parent->isPersisted() && $this->parent->getPreloadContainer() ? $this->getCachedCollection() : $this->getCollection();
return $collection->getEntityCount($this->parent);
}