Replace Corner Mullion

I want to replace curtain wall Mullion Corner mullions.
Currently we have Rectangular mullion placed in each end in the Element Type.
Replacing these vertical borders messes up the whole drawing and throw bunch of errors!

Is it possible to select a mullion, unpin it, replace with a pre-defined corner mullion and delete the “other” mullion via dynamo?

I don’t mind selecting them one by one but if there is a better way that would be great.

This is what I have so far

Look into the sparrow package which has a node built to pair up points by their closest neighbors, might be handy. You can get all mullions, get their centroid, pull it down to XY plane and pair them up. If the pairs are within say 100mm of each other then they’re probably corner pairs. Unpin both, delete the first, and swap the second to the corner type.