private int CheckInBags(IPassenger passenger, IEnumerable <int> bagsIndicesToCheckIn) { var bags = passenger.Bags; var confiscatedBagsCount = 0; foreach (var bagIndex in bagsIndicesToCheckIn) { var currentBag = bags[bagIndex]; bags.RemoveAt(bagIndex); if (ShouldConfiscate(currentBag)) { airport.AddConfiscatedBag(currentBag); confiscatedBagsCount++; } else { airport.AddCheckedBag(currentBag); } } return(confiscatedBagsCount); }