Iterate or loop selected record on grid

public container getSelectedItem()
{
    container _returnContainer ;

    HCMWorker               Worker;
    MultiSelectionHelper    helper  = MultiSelectionHelper::construct();


    helper.parmDatasource(HCMWorker_DS);
    Worker = helper.getFirst();

    while (Worker.RecId != 0)
    {
        _returnContainer += Worker.RecId;
        Worker = helper.getNext();
    }

    return _returnContainer;
}