Functions/New-IAGroupObject.ps1

Function New-IAGroupObject{
    Param(

        [Parameter(Mandatory = $true)]
        [String]$Title,
        [String]$Description,
        [Int]$WidthInPercentage,
        [Parameter(Mandatory = $true, ParameterSetName = "IAView")]
        [PSObject]$IAView,
        [Parameter(Mandatory = $true, ParameterSetName = "Interactive")]
        [Switch]$Interactive
    )

    $IAGroupObject = New-Object -TypeName PSObject
    $IAGroupObject | Add-Member -MemberType NoteProperty -Name 'Title' -Value $Title
   
    if($Description){
        
        $IAGroupObject | Add-Member -MemberType NoteProperty -Name 'Description' -Value $Description
    }

    if($WidthInPercentage){
        
        $IAGroupObject | Add-Member -MemberType NoteProperty -Name 'WidthInPercentage' -Value $WidthInPercentage
    }
    
    if($Interactive){

        $IAView = Get-IAView -All | Out-GridView -PassThru
    }

    $IAGroupObject | Add-Member -MemberType NoteProperty -Name 'ViewId' -Value $IAView.Id

    return $IAGroupObject
}