Added PreInsert and PreUpdate hooks to the Task model