public function generateAlteredMeta()
    {
        //get unmanaged converted to managed
        $managed = array_intersect(
            $this->oldUnmanagedKeys,
            $this->newModelKeys
        );

        //get managed converted to unmanaged
        $unmanaged = array_intersect(
            $this->oldModelKeys,
            $this->newUnmanagedKeys
        );

        $modelsToCheck = array_merge(
            $this->keptProxyKeys,
            $this->keptUnmanagedKeys,
            $managed,
            $unmanaged
        );

        $modelsToCheck = array_unique($modelsToCheck);

        /* @var $oldState ModelState */
        /* @var $newState ModelState */
        foreach ($modelsToCheck as $modelName) {
            $oldModelName = $this->getOldModelName($modelName);
            $oldState = $this->fromState->getModelState($oldModelName);
            $newState = $this->toState->getModelState($modelName);

            $oldMeta = [];

            if ($oldState->getMeta()) {
                foreach ($oldState->getMeta() as $name => $opt) {
                    if (AlterModelMeta::isAlterableOption($name)) {
                        $oldMeta[$name] = $opt;
                    }
                }
            }

            $newMeta = [];
            if ($newState->getMeta()) {
                foreach ($newState->getMeta() as $name => $opt) {
                    if (AlterModelMeta::isAlterableOption($name)) {
                        $newMeta[$name] = $opt;
                    }
                }
            }

            if ($oldMeta !== $newMeta) {
                $this->addOperation(
                    $newMeta->getAppName(),
                    AlterModelMeta::createObject(
                        [
                            'name' => $modelName,
                            'meta' => $newMeta,
                        ]
                    )
                );
            }
        }
    }