It only failed when trying to write 'utccreated' and other meta-data, when the readonly attribute was set. I just assumed it was the readonly attribute, once I removed the attributes and then re-applied them it worked fine.