Only assign generated key if one was generated; otherwise, use data.id as result.