code: function(err){
                  var error = null,
                      keys = null,
                      errMsg = '';
  
                  if(err.name == 'ValidationError'){
                      keys = _.keys(err.errors);
  
                      if(err.errors[keys[0]].path === 'salt'){
                          //Support for virtual fields.
                          errMsg = err.errors[keys[0]].message;
                      }
                      else if(err.errors[keys[0]].type === 'required'){
                          errMsg = '"' + err.errors[keys[0]].path + '" is a required field.';
                      }
                      else {
                          errMsg = err.errors[keys[0]].message;
                      }
  
                      error = createError(400, errMsg);
                  }
                  else if (err.name == 'MongoError' && (err.code == '11001' || err.code == '11000')) {
                      error = createError(400, 'Duplicate key already exists.');
                  }
                  else {
                      error = createError(err);
                  }
  
                  return error;
              }
docs: Filter/Format errors in a way that the system understands.
  
  @param err
  @returns Error