merge_attributes function

Merge and copy attributes