public function removeTab($tabName, FormMapper $formMapper)
    {
        $tabs = $this->getFormTabs();

        if (array_key_exists($tabName, $tabs)) {
            $groups = $this->getFormGroups();

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

            foreach ($tabs[$tabName]['groups'] as $group) {
                if (isset($groups[$group])) {
                    foreach ($groups[$group]['fields'] as $field) {
                        $formMapper->remove($field);
                    }
                }
                unset($groups[$group]);
            }

            $this->setFormGroups($groups);
            $this->removeEmptyGroups();
        }
    }