code: function purgeJointAndDependencies(objJoint, error, onPurgedDependentJoint, onDone){
  	var unit = objJoint.unit.unit;
  	assocKnownBadUnits[unit] = error;
  	db.takeConnectionFromPool(function(conn){
  		var arrQueries = [];
  		conn.addQuery(arrQueries, "BEGIN");
  		conn.addQuery(arrQueries, "INSERT "+conn.getIgnore()+" INTO known_bad_joints (unit, json, error) VALUES (?,?,?)", [unit, JSON.stringify(objJoint), error]);
  		conn.addQuery(arrQueries, "DELETE FROM unhandled_joints WHERE unit=?", [unit]); // if any
  		conn.addQuery(arrQueries, "DELETE FROM dependencies WHERE unit=?", [unit]);
  		collectQueriesToPurgeDependentJoints(conn, arrQueries, unit, error, onPurgedDependentJoint, function(){
  			conn.addQuery(arrQueries, "COMMIT");
  			async.series(arrQueries, function(){
  				delete assocUnhandledUnits[unit];
  				conn.release();
  				if (onDone)
  					onDone();
  			})
  		});
  	});
  }
docs: onPurgedDependentJoint called for each purged dependent unit