Does the UpdateSegmentPair method only works with the active segment?

I need to iterate through all target segments in a file and update all the target segments.
So I am using the Update SegmentPair method, but UpdateSegmentPair throws an Exception. The following is the code.

foreach (var segmentPair in segmentPairs)
{    
        // Some code to update the target
    editorController.ActiveDocument.UpdateSegmentPair(segmentPair);
}

If I make the segment active before calling the UpdateSegmentPair  method in the following code, then it works.
foreach (var segmentPair in segmentPairs)
{
    editorController.ActiveDocument.SetActiveSegmentPair(activeFile, segmentPair.Properties.Id.Id);
    editorController.ActiveDocument.UpdateSegmentPair(segmentPair);
}

Does the UpdateSegmentPair only works with the active segment?

Error Message: Object reference not set to an instance of an object.
System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Sdl.TranslationStudioAutomation.IntegrationApi

<HResult>-2147467261</HResult>
<![CDATA[ at Sdl.TranslationStudioAutomation.IntegrationApi.Document.UpdateSegmentPair(ISegmentPair segmentPair) at

Parents Reply Children
No Data