docs: function beforeList (controller, args, fields, title, form, links, defaultQueryArgs) {
      // get model from controller
      var model = controller.model
      // set limit
      var limit = args.limit || controller.defaultLimit
      var offset = args.offset || 0
      // set to true to show clear option for filters/sort
      var clear = false
      // set minimum limit to 2
      if (limit < 2) {
          limit = 2
      }
      // build arguments for query
      var query = {
          session: args.session,
      }
      // if query args are passed use them
      if (defined(defaultQueryArgs)) {
          _.merge(query, defaultQueryArgs)
      }
      // add order if set
      if (defined(args.orderColumn)) {
          query.order = [args.orderColumn]
          // if custom order is set add clear option
          clear = true
          // add direction if set
          if (defined(args.orderDirection)) {
              query.order.push(args.orderDirection)
          }
      }
      // add where if set
      if (defined(args.where)) {
          query.where = JSON.parse(args.where)
      }
      // included deleted records
      if (defined(args.deleted)) {
          // create where query if not set
          if (!defined(query.where)) {
              query.where = {}
          }
          // include deleted records - if argument is only then only deleted
          query.where.isDeleted = args.deleted === 'only'
              ? true: null
      }
      // add extra columns as query param options
      _.each(model.extraColumns, (spec, name) => {
          // if param is set in args add to where query
          if (typeof args[name] === 'string') {
              // create where query if not set
              if (!defined(query.where)) {
                  query.where = {}
              }
              // if query is quoted then do exact match
              var queryArg = args[name].charAt(0) === '"' && args[name].charAt(args[name].length - 1) === '"'
                  // strip leading and trailing quotes
                  ? args[name].substr(1, args[name].length - 2)
                  // add wildcards to string
                  : `%${args[name]}%`
              // set like query
              query.where[name] = {like: queryArg}
              // if filter is set add clear option
              clear = true
              // and param to sort links
              _.each(fields, field => {
                  if (field.orderAscUrl) {
                      field.orderAscUrl += '&'+name+'='+args[name]
                  }
                  if (field.orderDescUrl) {
                      field.orderDescUrl += '&'+name+'='+args[name]
                  }
              })
          }
      })
      // if originalId set add to query
      if (args.originalId) {
          // create where query if not set
          if (!query.where) {
              query.where = {}
          }
          // set originalId in query
          query.where.originalId = {eq: args.originalId}
      }
      // do database query
      return model.query(query)
      // prepare args for primary method
      .then(result => {
          // remove session from query args for presentation
          delete query.session
          // fetch records
          return result.fetch(limit, offset)
          // resolve with result and record data
          .then(records => {
              // add actions to records
              _.each(records, record => {
                  buildActions(controller, record)
              })
              // return data that will be merged into args for primary method
              return {
                  clear: clear,
                  fields: fields,
                  form: form,
                  links: links,
                  query: query,
                  records: records,
                  result: {
                      length: result.length,
                  },
                  title: title,
              }
          })
      })
  }