           This would sort ascending by createdAt and descending by title. Ascending is assumed by default
     ###
     buildConditionsFromParameters: (parameters) ->
-
       ###
           Some parameter names are reserved and have a special meaning
       ###
       reservedParams = ["sort","include","includes","limit","offset","method","controller","action","format"]
 
       # only accept parameters that represent an attribute for where conditions
-      allowedWhereAttributes = []
-      allowedWhereAttributes.push key for key,value of App[@resourceOptions.resourceClass].metadata().attributes
+      allowedWhereAttributes = _.keys(App[@resourceOptions.resourceClass].metadata().attributes)
 
       conditions = {}
 

            # includes can contain multiple classes
            includeParams = value.split(",")
            for value in includeParams
              unless conditions.includes?
                  conditions.includes = []
              conditions.includes.push value
          continue
        if key not in allowedWhereAttributes
          continue
        # all other parameter names are treated as where conditions
        unless conditions.where?
          conditions.where = {}
        firstChar = value[0]
        checksForEquality = firstChar isnt ">" and firstChar isnt "<"
        if not checksForEquality

        else
          conditions.where[key] = value


      conditions

    applyConditionsToScope: (scope, conditions) ->
