Fix migration of CIP attachments.

Also remove commented code and fix a reference to old type field.