     if current and remainder.length > 0
       cascadeData[current].nextElement = cascadeFormElements set, remainder, module, permission, roleCount
     return cascadeData
+
 
   optionizePermissions = (roles, set) ->
 

            return yes
        return no

  cascadeFormElements = (set,roles,module,permission,roleCount=0)->

    [current,remainder...] = roles
    cascadeData = {}

            cascadeFormElements set, roles, module, permission, roles.length
    permissionOptions


  createTree = (values) ->
    values.reduce (acc, { module, role, permission }) ->
      acc[module] ?= {}
      acc[module][role] ?= []
      acc[module][role].push permission
      return acc
    , {}


  createReducedList = (values) ->
    cache = {}
    values.reduce (acc, { module, role, permission }) ->
      storageKey = "#{module}:#{role}"
      cached = cache[storageKey]
      if cached?
