 
 constructTaskLogObject = (calculatorUserID, messageIdentifierString, callback) ->
   taskLogObject = new TaskLog
+    "createdAt": new Date()
     "calculator":calculatorUserID
     "sentDate": Date.now()
     "messageIdentifierString":messageIdentifierString

  taskLogObject.sessions = taskObject.sessions
  taskLogObject.save (err) -> callback err

  winston.info "Game successfully simulated in #{taskObject.calculationTimeMS}, logging result"


updateScores = (taskObject,callback) ->

  sessionIDs = _.pluck taskObject.sessions, 'sessionID'
  async.map sessionIDs, retrieveOldScoreMetrics, (err, oldScores) ->
    callback err, {"error": "There was an error retrieving the old scores"} if err?
    oldScoreArray = _.toArray putRankingFromMetricsIntoScoreObject taskObject, oldScores

    newScoreArray = bayes.updatePlayerSkills oldScoreArray
    
    #TODO: database persistence here
    callback err, newScoreArray

putRankingFromMetricsIntoScoreObject = (taskObject,scoreObject) ->
  scoreObject = _.indexBy scoreObject, 'id'
  for session in taskObject.sessions
    scoreObject[session.sessionID].gameRanking = session.metrics.rank

  return scoreObject

retrieveOldScoreMetrics = (sessionID, callback) ->
  LevelSession.findOne {"_id":sessionID}, (err, session) ->
