Copy source segment to target segment in Trados Editor

I have been trying to copy a segment text from source to target, but I couldn't be able to do that.

Is there a way to do this?

I tried the following code, but it didn't work. If there is a text or blank character in the target field, then I can do that.

doc.ProcessSegmentPairs("Copy",
                   (segPair, eventArg) =>
                   {
                       foreach (IAbstractMarkupData markupData in segPair.Source)
                       {                             
                               var text = markupData as IText;

                               if (text != null)
                               {
                                   (((IAbstractMarkupData )segPair.Target) as IText).Text = text.Properties.Text;
                               }                       
                       }
                   });