return id after writing object