private function getClassesForCommitAction(array $documents, bool $includeEmbedded = false) : array
    {
        if (empty($documents)) {
            return [];
        }
        $divided = [];
        $embeds  = [];
        foreach ($documents as $oid => $d) {
            $className = get_class($d);
            if (isset($embeds[$className])) {
                continue;
            }
            if (isset($divided[$className])) {
                $divided[$className][1][$oid] = $d;
                continue;
            }
            $class = $this->dm->getClassMetadata($className);
            if ($class->isEmbeddedDocument && ! $includeEmbedded) {
                $embeds[$className] = true;
                continue;
            }
            if (empty($divided[$class->name])) {
                $divided[$class->name] = [$class, [$oid => $d]];
            } else {
                $divided[$class->name][1][$oid] = $d;
            }
        }
        return $divided;
    }