public function setForm($key, $spec, $enabled = true)
    {
        if (is_object($spec)) {
            if ($spec instanceof FormParentInterface) {
                $spec->setParent($this);
            }

            $spec = [ '__instance__' => $spec, 'name' => $key, 'entity' => '*' ];
        }

        if (!is_array($spec)) {
            $spec = array('type' => $spec, 'name' => $key);
        }
        if (!isset($spec['name'])) {
            $spec['name'] = $key;
        }
        if (!isset($spec['entity'])) {
            $spec['entity'] = '*';
        }
        
        $this->forms[$key] = $spec;

        if ($enabled) {
            $this->enableForm($key);
        } elseif (true === $this->activeForms) {
            $this->activeForms = false;
        }
        return $this;
    }