I have a application that consists of projects and tasks. A project can have many tasks linked by the project id. When I mark a project as complete or cancelled and then go to save it, I would like to check to see if any related tasks are open (not closed or cancelled). If any tasks have a status other than closed or cancelled, I would like to prevent the project from being saved.
What would be the best approach to accomplish this?