private function computeSingleEntityChangeSet($entity)
    {
        $state = $this->getEntityState($entity);

        if ($state !== self::STATE_MANAGED && $state !== self::STATE_REMOVED) {
            throw new \InvalidArgumentException("Entity has to be managed or scheduled for removal for single computation " . self::objToStr($entity));
        }

        $class = $this->em->getClassMetadata(get_class($entity));

        if ($state === self::STATE_MANAGED && $class->isChangeTrackingDeferredImplicit()) {
            $this->persist($entity);
        }

        // Compute changes for INSERTed entities first. This must always happen even in this case.
        $this->computeScheduleInsertsChangeSets();

        if ($class->isReadOnly) {
            return;
        }

        // Ignore uninitialized proxy objects
        if ($entity instanceof Proxy && ! $entity->__isInitialized__) {
            return;
        }

        // Only MANAGED entities that are NOT SCHEDULED FOR INSERTION OR DELETION are processed here.
        $oid = spl_object_hash($entity);

        if ( ! isset($this->entityInsertions[$oid]) && ! isset($this->entityDeletions[$oid]) && isset($this->entityStates[$oid])) {
            $this->computeChangeSet($class, $entity);
        }
    }