optimize access to attributes in Document#save_attributes method