ID and reference ID validation.