/**
   * @param model The wizard model
   * @return True if the wallet creation was successful
   */
  private boolean handleCreateWalletStatus(WelcomeWizardModel model) {

    // Attempt to create the wallet
    switch (model.getRestoreMethod()) {
      case RESTORE_WALLET_SELECT_BACKUP:
        log.debug("Performing a restore from a seed phrase and a wallet backup.");

        EnterSeedPhraseModel restoreWalletEnterSeedPhraseModel =
            model.getRestoreWalletEnterSeedPhraseModel();

        // Create the wallet
        return createWalletFromSeedPhrase(restoreWalletEnterSeedPhraseModel.getSeedPhrase());
      case RESTORE_WALLET_TIMESTAMP:
        log.debug("Performing a restore from a seed phrase and a timestamp.");

        EnterSeedPhraseModel restoreEnterSeedPhraseModel =
            model.getRestoreWalletEnterSeedPhraseModel();
        EnterSeedPhraseModel restoreEnterTimestampModel =
            model.getRestoreWalletEnterTimestampModel();
        ConfirmPasswordModel confirmPasswordModel = model.getRestoreWalletConfirmPasswordModel();
        log.debug("Timestamp: {}", restoreEnterTimestampModel.getSeedTimestamp());
        log.debug("Wallet type: {}", restoreEnterSeedPhraseModel.getRestoreWalletType());

        // Create the wallet
        return createWalletFromSeedPhraseAndTimestamp(
            restoreEnterSeedPhraseModel.getSeedPhrase(),
            restoreEnterSeedPhraseModel.getRestoreWalletType(),
            restoreEnterTimestampModel.getSeedTimestamp(),
            confirmPasswordModel.getValue());
      case RESTORE_WALLET_HARD_TREZOR:
        log.debug("Performing a restore of a hard trezor.");
        return createTrezorHardWallet();
      default:
        log.error("Unknown welcome wizard state: {}", model.getRestoreMethod());
        SwingUtilities.invokeLater(
            new Runnable() {
              @Override
              public void run() {
                LabelDecorator.applyStatusLabel(walletCreatedStatusLabel, Optional.of(false));
                walletCreatedStatusLabel.setVisible(true);
              }
            });
        return true;
    }
  }
  /** Handle the process of restoring a wallet */
  private void handleRestoreWallet() {

    WelcomeWizardModel model = getWizardModel();

    log.debug("The select wallet choice is {}", model.getSelectWalletChoice());
    log.debug("The restore method is {}", model.getRestoreMethod());

    // There are two sorts of restore wallet method:
    // RESTORE_WALLET_SEED_PHRASE = restore from a seed phrase and timestamp (MBHD soft wallet or
    // Trezor soft wallet)
    // RESTORE_WALLET_BACKUP = restore from a seed phrase and wallet backup

    final boolean backupLocationStatus = handleBackupLocation();

    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {

            LabelDecorator.applyStatusLabel(
                backupLocationStatusLabel, Optional.of(backupLocationStatus));
            backupLocationStatusLabel.setVisible(true);

            // Hide the header view (switching back on is done in
            // MainController#onBitcoinNetworkChangedEvent
            ViewEvents.fireViewChangedEvent(ViewKey.HEADER, false);
          }
        });

    // Give the user the impression of work being done
    Uninterruptibles.sleepUninterruptibly(250, TimeUnit.MILLISECONDS);

    final boolean walletCreatedStatus = handleCreateWalletStatus(model);
    log.debug("Wallet created status: {}", walletCreatedStatus);

    // Update created wallet status
    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            LabelDecorator.applyStatusLabel(
                walletCreatedStatusLabel, Optional.of(walletCreatedStatus));
            walletCreatedStatusLabel.setVisible(true);
          }
        });

    // Give the user the impression of work being done
    Uninterruptibles.sleepUninterruptibly(250, TimeUnit.MILLISECONDS);

    final boolean caCertificatesStatus = handleCACertificateStatus();

    // Update the UI
    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {

            LabelDecorator.applyStatusLabel(
                caCertificateStatusLabel, Optional.of(caCertificatesStatus));
            caCertificateStatusLabel.setVisible(true);
          }
        });

    // Give the user the impression of work being done
    Uninterruptibles.sleepUninterruptibly(250, TimeUnit.MILLISECONDS);

    // Allow the Finish button at this point since the Bitcoin network may fail and the user will be
    // trapped
    ViewEvents.fireWizardButtonEnabledEvent(
        WelcomeWizardState.RESTORE_WALLET_REPORT.name(), WizardButton.FINISH, true);

    final boolean walletSynchronizationStatus = handleSynchronizationStatus();

    // Update the UI
    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {

            LabelDecorator.applyStatusLabel(
                synchronizationStatusLabel, Optional.of(walletSynchronizationStatus));
            synchronizationStatusLabel.setVisible(true);
          }
        });
  }