Seems like there can be a utility function that does this since I've seen it three times already. It can take data as a param and return data with the relevant key/value added.