When dealing with transactions lines:
• Define something unique per line (that becomes your key).
• Build an object where key: {your data}
• Do your search and also return an Object with same keys.
Then merging that data or updating your lines data object from the search becomes something like: