Merge metadata from transaction instead of replace

This was replacing metadata when set in transactions rather
than merging. To fix this, merge has been augmented to also
report if a change occurred and to erase empty entries (as
a mechanism to "unset" metadata)

Bug: 122925737
Test: Added more unittests
Change-Id: Ia854cbcc1ddd334f18ffacea667cbb98778ec210
6 files changed