public function afterInsert()
    {
        /** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
        $owner = $this->owner;
        $groups = $owner->propertyGroupIds;
        $owner->propertyGroupIds = null;
        $event = new HasPropertiesEvent();
        $event->model = $owner;
        HasPropertiesEvent::trigger(self::class, self::EVENT_AFTER_SAVE, $event);
        if (count($groups) > 0) {
            foreach ($groups as $group_id) {
                /** @var PropertyGroup $group */
                $group = PropertyGroup::findOne(['id' => $group_id]);
                if ($group) {
                    $owner->addPropertyGroup($group);
                }
            }
        }

        $handlers = PropertyStorageHelper::getHandlersForModel($owner);
        $models = [&$owner];
        foreach ($handlers as $handler) {
            $handler->modelsInserted($models);
        }
        $this->afterSave();
    }