adding/updating task statuses using 'upsert' to avoid race condition