 
     if link and data[link]
       if @subscriptions[subsName] and not _.isEmpty @subscriptions[subsName]
-        oldIds = _.map @subscriptions[subsName], (doc) ->
-          return doc._id
-
-        newIds = _.map data[link], (doc) ->
-          return doc._id
+        oldIds = (doc._id for doc in @subscriptions[subsName])
+        newIds = (doc._id for doc in data[link])
 
         diff = _.difference oldIds, newIds
         if diff and not _.isEmpty diff

        else
          _id = doc._id

        doc._id = _id

        @subscriptions[subsName].push _.clone doc


        i = _res.length - 1

        while i >= 0
          if !!~_res[i].indexOf('.')
            _res[i] = _res[i].replace '.', '_'
          i--


        _res = for str in _res
          str = str.trim()
          if !!~str.indexOf ' AS '
            str = _.last str.split ' '
          str

        _clauses = _.last(_res)
        if !!~_clauses.indexOf(' ')
          _clause = _.first _clauses.split ' '
          _res[_res.length - 1] = _clause

        for i of _res
          _res[i] = _res[i].trim()
          _originals[i] = _res[i]
          if !!~_res[i].indexOf(' ')
            _res[i] = _.last _res[i].split ' '
            _originals[i] = _.first _res[i].split ' '
          _data[_res[i]] = []

        for result in data
          for i of _res
            if !!result[_res[i]]
              switch
                when !!~_res[i].indexOf('(') and !!~_res[i].indexOf(')')
                  _data[_res[i]] = result[_res[i]]
                when !!~_originals[i].indexOf('.') or _.isString(result[_res[i]]) or _.isNumber(result[_res[i]]) or _.isBoolean(result[_res[i]]) or _.isDate(result[_res[i]]) or _.isNaN(result[_res[i]]) or _.isNull(result[_res[i]]) or _.isUndefined(result[_res[i]])
                  _data[_res[i]].push result[_res[i]]
                else
                  if !!result[_res[i]].data and !!result[_res[i]]._data and !!result[_res[i]]._data.metadata
                    result[_res[i]].data.metadata = result[_res[i]]._data.metadata

                  if !!result[_res[i]]._data and !!result[_res[i]]._data.start and !!result[_res[i]]._data.end and !!result[_res[i]]._data.type
                    result[_res[i]].data.relation =
                      extensions: result[_res[i]]._data.extensions
                      start: _.last result[_res[i]]._data.start.split '/'
                      end: _.last result[_res[i]]._data.end.split '/'
                      self: _.last result[_res[i]]._data.self.split '/'
                      type: result[_res[i]]._data.type

                  if !!result[_res[i]].data
                    _data[_res[i]].push result[_res[i]].data

    @returns = _res
    _data
