public function create()
    {
        $this->add();
        $this->validateIntegrationRequest();
        if (!$this->token->validate('create')) {
            $this->error->add($this->token->getErrorMessage());
        }

        if ($this->error->has()) {
            return;
        }

        $factory = $this->app->make(ClientFactory::class);
        $credentials = $factory->generateCredentials();

        // Create a new client while hashing the new secret
        $client = $factory->createClient(
            $this->request->request->get('name'),
            $this->request->request->get('redirect'),
            [],
            $credentials->getKey(),
            password_hash($credentials->getSecret(), PASSWORD_DEFAULT)
        );

        // Persist the new client to the database
        $this->entityManager->persist($client);
        $this->entityManager->flush();
        $this->flash('success', t('Integration saved successfully.'));
        $this->flash('clientSecret', $credentials->getSecret());

        return $this->redirect('/dashboard/system/api/integrations/', 'view_client', $client->getIdentifier());
    }