Fix upsert logic: take into account that array can be passed as param as well