   if([String]::IsNullOrEmpty($source))
    {
        throw "No source found"
    }

    if([String]::IsNullOrEmpty($path))
    {
        throw "No path found"
    }

    [bool]$result = $true
    if(Test-Path $path)
    {
        return $true
    }

    try
    {
        [string]$ThemeManagementSource = Get-ThemeManagementSourceCode
        $type = Add-Type -TypeDefinition $ThemeManagementSource -PassThru
        $result = $type::CompileCSCode($source, $path)
    }
    catch
    {
        $result = $false
    }

    return $result
}

# Function to call theme API
function Invoke-Method([string]$source = $(throw "No source is specified"), [string]$themeToolName = $(throw "No theme tool name is specified"), [string]$methodName = $(throw "No method name is specified"))
{
    if([String]::IsNullOrEmpty($source))
    {
        throw "No source found"
    }

    if([String]::IsNullOrEmpty($themeToolName))
    {
        throw "No theme tool name found"
    }

    if([String]::IsNullOrEmpty($methodName))
    {
        throw "No method name found"
    }

    [string]$result = ""

    if(-not(Compile-CSCode $source $themeToolName))
    {
        return ""
    }

    return (Invoke-Expression ".\$themeToolName $methodName").Trim()
}

# Function to convert power source name
function ConvertTo-PowerSourceName($powerSource=$(throw "No power source is specified")) {
    [string]$powerSourceName = ""
    if(([Windows.Forms.PowerLineStatus]::Online) -eq $lineOn) {
        $powerSourceName = ($localizationString.onlinePowerSource)
    } elseif (([Windows.Forms.PowerLineStatus]::Offline) -eq $lineOn) {
        $powerSourceName = ($localizationString.offlinePowerSource)
    } else {
        $powerSourceName = ($localizationString.unknownPowerSource)
    }

    return $powerSourceName
}

# Function to wait for expected service status
function WaitFor-ServiceStatus([string]$serviceName=$(throw "No service name is specified"), [ServiceProcess.ServiceControllerStatus]$serviceStatus=$(throw "No service status is specified")) {
    [ServiceProcess.ServiceController]$sc = New-Object "ServiceProcess.ServiceController" $serviceName
    [TimeSpan]$timeOut = New-Object TimeSpan(0,0,0,5,0)
    $sc.WaitForStatus($serviceStatus, $timeOut)
}