public function removeRole( core_kernel_classes_Resource $role)
    {
        $returnValue = (bool) false;
        
    	if (GENERIS_CACHE_USERS_ROLES == true && core_kernel_users_Cache::areIncludedRolesInCache($role)){	
    		
    		if ($role->delete(true) == true){ // delete references.
        		$returnValue = core_kernel_users_Cache::removeIncludedRoles($role);
        		
        		// We also need to remove all included roles cache that contain
        		// the role we just deleted.
        		foreach ($this->getAllRoles() as $r){
        			if (array_key_exists($role->getUri(), $this->getIncludedRoles($r))){
        				core_kernel_users_Cache::removeIncludedRoles($r);
        			}
        		}
        	}
        	else{
        		$roleUri = $role->getUri();
        		$msg = "An error occured while removing role '${roleUri}'. It could not be deleted from the cache.";
        		throw new core_kernel_users_Exception($msg);
        	}
        }
        else{
        	$returnValue = $role->delete(true);	// delete references to this role!
        }

        return (bool) $returnValue;
    }