Why not just use $list->getForeignID()?