private static function scrubAttributes($field, $type = null)
    {
        $invalid_keys = [
            'default',
            'description',
            'label',
            'options',
        ];

        if ($type && $type ==='textarea') {
            $invalid_keys[] = 'value';
        }

        foreach ($invalid_keys as $invalid_key) {
            if (array_key_exists($invalid_key, $field)) {
                unset($field[$invalid_key]);
            }
        }
        return $field;
    }