public function update(Listener $listener, Fluent $extension, array $input)
    {
        if (! Extension::started($extension->get('name'))) {
            return $listener->suspend(404);
        }

        $validation = $this->validator->with($input, ["orchestra.validate: extension.{$extension->get('name')}"]);

        if ($validation->fails()) {
            return $listener->updateConfigurationFailedValidation($validation->getMessageBag(), $extension->uid);
        }

        $input['handles'] = str_replace(['{domain}', '{{domain}}'], '{{domain}}', $input['handles']);
        unset($input['_token']);

        $memory = Foundation::memory();
        $config = (array) $memory->get("extension.active.{$extension->get('name')}.config", []);
        $input = new Fluent(\array_merge($config, $input));

        Event::dispatch("orchestra.saving: extension.{$extension->get('name')}", [&$input]);

        $memory->put("extensions.active.{$extension->get('name')}.config", $input->getAttributes());
        $memory->put("extension_{$extension->get('name')}", $input->getAttributes());

        Event::dispatch("orchestra.saved: extension.{$extension->get('name')}", [$input]);

        return $listener->configurationUpdated($extension);
    }