/**
	 * Handle an orphaned row in the database and perform proper
	 * cleanup for it.
	 * 
	 * @param integer $ID
	 * 
	 * @return boolean
	 */
	public function handleBrokenDataObject($ID) {
		JanitorDebug::message("handleBrokenDataObject({$ID})");
		$stages = $this->getDataObjectStages($this->dataObject);
		foreach ($stages as $stage) {
			$tablePostfix = $stage == 'Stage'? '': "_{$stage}";
			$query = "SELECT \"ID\" FROM \"{$this->table}{$tablePostfix}\" WHERE \"ID\" = {$ID}";
			if (DB::query($query)->value()) {
				$query = "DELETE FROM \"{$this->table}{$tablePostfix}\" WHERE \"ID\" = {$ID}";
				JanitorDebug::message("Running query: {$query}", 'p', 'color:#ff0000');
				DB::query($query);
			}
		}
		
		// Since the DataObject has been deleted at some point we
		// should perform the after delete cleaning on the mock
		// DataObject to ensure that relations are handled properly.
		$this->dataObject->onAfterDeleteCleaning();
		
		return true;
	}