I'd suggest putting these five lines into a new method called ```data.ReconnectToPort```, it takes a connector ```XmlElement```, a ```endNodeId``` and a ```endPortIndex```. Then we can do the null-check inside the method just like the other ```ReconnectToPort```.