I discovered that the transaction was not nicely encapsulated in a using statement, as it should be, so I fixed that.

I also discovered that a bug was introduced during the migration from Revit 2013 to 2014.
Apparently, this command was never tested in Revit 2014 and the error remained undetected ever since.
So I fixed that as well.

Addendum: As Matt Taylor kindly points out below, the Revit 2014 API introduced the powerful
copy and paste API,
which can be used to easily implement a more complete solution that the one presented above.