public function removeEmptyGroups()
    {
        $tabs = $this->getFormTabs();

        if (!is_array($tabs)) {
            return;
        }

        $groups = $this->getFormGroups();

        foreach ($tabs as $tabKey => $tab) {
            foreach ($tab['groups'] as $tabGroup) {
                if (!array_key_exists($tabGroup, $groups)) {
                    unset($tabs[$tabKey]);
                }
            }
        }

        $this->setFormTabs($tabs);
    }