Private/Presentation/DashboardRefreshAction.ps1

function New-DashboardRefreshAction {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory)]
        [System.Management.Automation.FunctionInfo]$Command,

        [Parameter(Mandatory)]
        [hashtable]$Lifetime
    )

    {
        if ($Lifetime.Active) {
            & $Command
        }
    }.GetNewClosure()
}