Upsert objects in an Action function

Is there a first-class way to upsert objects in an Action? I’d like to do code like

const resource = Objects.create().resourceType(possiblyDuplicateId)
resource.updated_at = ...

and have it create a new object if necessary, or update data for the existing object with that id. When I try this code in a function currently, it gets an error for duplicate ids.