Is it possible to add new tags to the target side of a segment pair through the Trados 2017 API?

I have tried using the Visitor functionality to do this and have had no success. The following code shows what I have tried:

 

EditorController ec = SdlTradosStudio.Application.GetController<EditorController>();

Document d = ec.ActiveDocument;

IStartTagProperties start = d.ItemFactory.PropertiesFactory.CreateStartTagProperties("<language id='000'>");

IStartTagProperties end = d.ItemFactory.PropertiesFactory.CreateEndTagProperties("</language>");

ITagPair newTagPair = d.ItemFactory.CreateTagPair(start, end);

d.ActiveSegmentPair.Target.AcceptVisitor(new Visitor(newTagPair));

d.UpdateSegmentPair(d.ActiveSegmentPair);

 

The Visitor class has an ITagPair object as a member variable. The VisitSegment() method just looks like this:

public void VisitSegment(ISegment segment)
{
    segment.Add(tagPair);
}

 

Am I missing something? Or is it just not possible to add new tags to a segment in Trados Studio 2017?