Private/Save-DuneSession.ps1

function Save-DuneSession {
    $path = "$env:USERPROFILE\.dune\session.clixml"
    if ($DuneSession) {
        if (-not (Test-Path $path)) { $null = New-Item -ItemType File -Path $path -Force }
        $null = $DuneSession | Export-CliXml -Path $path
        Write-Verbose "Session information saved"
    }
    else {
        Write-Warning "Can not save session. No session found"
    }
}