/**
  * Install the system.
  *
  * @param array $parameters
  * @return bool
  */
 public function install(array $parameters)
 {
     $this->dispatch(new GenerateEnvironmentFile($this->dispatch(new GetEnvironmentVariables($parameters))));
     $this->dispatch(new SetupApplication($parameters));
     $this->dispatch(new RunMigrations());
     $this->dispatch(new InstallAllModules(true));
     $this->dispatch(new InstallAllExtensions(true));
     $this->dispatch(new AutoloadEntryModels());
     $this->dispatch(new RegisterAddons());
     $credentials = ['email' => $parameters['admin_email'], 'username' => $parameters['admin_username'], 'password' => $parameters['admin_password']];
     $user = $this->users->create($credentials, true);
     $admin = $this->roles->create(['en' => ['name' => 'Administrator'], 'slug' => 'admin']);
     $this->roles->create(['en' => ['name' => 'User'], 'slug' => 'user']);
     $this->users->attachRole($user, $admin);
     $application = $this->applications->newInstance();
     $application->enabled = true;
     $application->name = array_get($parameters, 'application_name');
     $application->domain = array_get($parameters, 'application_domain');
     $application->reference = array_get($parameters, 'application_reference');
     $application->save();
     return true;
 }