Hi Everyone,
First of all, thank you to all for providing your valuable suggestions. Before going through your answers , I did some experiments on the solution and managed to implement it . I will just write it through for any future references.
Added an extra attribute of boolean type (IsAgencyTied) to the structure of the list. Set the default value of this attribute to false.
Did a loop through over the list and in each iteration :
1. Checked whether the current row number is greater than zero.
2. Added two local variables, CurrentRowIndex and PreviousRowIndex assigned the value List.CurrentRowNumber and List.CurrentRowNumber-1 .
3. Used another two local variables CurrentRecordAgency and PreviousRecordAgency and assigned the value List[CurrentRowIndex].Agency and List[PreviousRowIndex].Agency.
4. Finally compared whether CurrentRecordAgency is equal to PreviousRecordAgency and if so, set the List.IsAgencyTied to true.
The suggestions you provided quite similar to my solution , hence thank you once again.