         return errors.serverError res, "There was an error dispatching the task: #{err}"
     sendResponseObject req, res, taskObjectToSend
 
-  
-  
+
+
 checkSimulationPermissions = (req, cb) ->
-  if isUserAnonymous req 
+  if isUserAnonymous req
     cb "You need to be logged in to simulate games"
   else
     cb null
-    
+
 receiveMessageFromSimulationQueue = (cb) ->
-  scoringTaskQueue.receiveMessage (err, message) -> 
+  scoringTaskQueue.receiveMessage (err, message) ->
     if err? then return cb "No more games in the queue, error:#{err}"
     if messageIsInvalid(message) then return cb "Message received from queue is invalid"
     cb null, message

  sendEachTaskPairToTheQueue taskPairs, (taskPairError) ->
    if taskPairError? then return callback taskPairError
    callback null, {"message": "All task pairs were succesfully sent to the queue"}
  

module.exports.dispatchTaskToConsumer = (req, res) ->
  async.waterfall [

      majorVersion: levelMajorVersion

  query = LevelSession
  .find(findParameters)
  .lean()

  query.exec (err, result) ->
    if err? then return errors.serverError res, err
