Serialization for the new item attributes

This commit also cleans up the serialization code in other classes.