Added validations to tasks for referential integrity.