Change Family type of a list of pipe fittings-Error

Hi all I would like to change generic elbow families at once to welded.


I have writen a code as shown below.

Its giving me an error related to ChangeTypeId method.Can somebody help?
Testing.dyn (8.3 KB)

This is the method I am trying to implement.

https://www.revitapidocs.com/2022/6026a054-5e1e-5cac-7283-aa102aa997e3.htm