public static void setPermissions(ChunkyObject object, ChunkyObject permObject, HashMap<PermissionFlag, Boolean> flags) {
        if (flags == null) {
            ChunkyManager.getPermissions(object, permObject).clearFlags();
            DatabaseManager.getDatabase().removePermissions(object, permObject);
            return;
        }
        PermissionRelationship perms = ChunkyManager.getPermissions(object, permObject);
        for (Map.Entry<PermissionFlag, Boolean> flag : flags.entrySet()) {
            perms.setFlag(flag.getKey(), flag.getValue());
        }

        // persist
        DatabaseManager.getDatabase().updatePermissions(permObject, object, perms);
    }