public Transaction deactivateCurrentActivateNew(Optional<Session> active, Session prepared, boolean force) {
        Tenant tenant = tenantRepository.getTenant(prepared.getTenantName());
        Transaction transaction = tenant.getSessionRepository().createActivateTransaction(prepared);
        if (active.isPresent()) {
            checkIfActiveHasChanged(prepared, active.get(), force);
            checkIfActiveIsNewerThanSessionToBeActivated(prepared.getSessionId(), active.get().getSessionId());
            transaction.add(active.get().createDeactivateTransaction().operations());
        }
        transaction.add(updateMetaDataWithDeployTimestamp(tenant, clock.instant()));
        return transaction;
    }
Creates a new deployment from the active application, if available.
This is used for system internal redeployments, not on application package changes.

@param application the active application to be redeployed
@param timeout the timeout to use for each individual deployment operation
@param bootstrap the deployment is done when bootstrapping
@return a new deployment from the local active, or empty if a local active application
        was not present for this id (meaning it either is not active or active on another
        node in the config server cluster)
configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationRepository.java