             return yes
         return no
 
-  cascadeFormElements = (set,roles,module,permission,roleCount=0)->
+
+  cascadeFormElements = (set, roles, module, permission, roleCount = 0) ->
 
     [current,remainder...] = roles
     cascadeData = {}

      when 'tree'         then return createTree values
      else throw new Error "Unknown structure #{structure}"

  getPermissionsOfRole: (role)->
    allValues = @list()
    selectedRoleValues = []
    selectedRoleValues.push permission for permission in allValues when permission.role is role

            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?
