protected function getBlockGroupId(BlockInterface $blockObject)
    {
        $groupClassName = $blockObject->blockGroup();
        
        $groupClassName = '\\'  . ltrim($groupClassName, '\\');
        
        $groupObject = Yii::createObject(['class' => $groupClassName]);
        
        $group = BlockGroup::findOne(['identifier' => $groupObject->identifier()]);
        
        if ($group) {
            $group->updateAttributes([
                'name' => $groupObject->label(),
                'class' => $groupClassName,
                'is_deleted' => false,
            ]);
            
            return $group->id;
        } else {
            $model = new BlockGroup();
            $model->name = $groupObject->label();
            $model->identifier = $groupObject->identifier();
            $model->created_timestamp = time();
            $model->class = $groupClassName;
            if ($model->save()) {
                $this->addLog("Insert new block group {$model->name}.");
                return $model->id;
            }
        }
        
        return 0;
    }