Transactions: Add trailing retainMetadata when there is trailing metadata.

Ensure that all transactions move the cursor past the trailing
metadata, if present.

Change-Id: I869c75f8cfabe1e14bb66d8e627d0b750bde46af
Merge "Transactions: Add trailing retainMetadata when there is trailing metadata."