Use task id from options if available

Changed Task.publish to check if the options object contains an id and use it, if not generates the id with uuid.v4 (as before)