Delete() Issue

Okay so I have every part of this method working properly except what is in the foreach loop. I can’t figure out why “$found->delete();” is not deleting all the Tasks I’m asking it to. “$model->delete();” works perfectly fine deleting my Project Model.

What am I missing here?

[indent]

public function actionDeleteLead($id)

{


            $model = $this->loadProjectModel($id);


            $tasklistID = $model->tasklist;


            $search = JTaskTasklist::model()->findAll('tasklist_id=:tasklist_id', array(':tasklist_id'=>$tasklistID));


            


            foreach($search as $joint)


            {    


                //Deletes all tasks


                $found = Task::model()->findByPk($joint->task_id);


                $found->delete();


            }


             


	//Deletes all joints


            JTaskTasklist::model()->deleteAllByAttributes(array('tasklist_id'=>$tasklistID));


            


            //Deletes tasklist


            $tasklist = Tasklist::model()->findByPk($tasklistID);


            $tasklist->delete();


            


             //Deletes Builder/Project joint


            JBuildProj::model()->deleteAllByAttributes(array('project_id'=>$id));


	


            //Deletes project


            $model->delete();





	// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser


	if(!isset($_GET['ajax']))


		$this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));	


}[/indent]