 
   try
     yield Client.findByIdAndUpdate(clientId, clientData).exec()
+    logger.info "User #{this.authenticated.email} updated client with id #{clientId}"
     this.body = 'Successfully updated client.'
-    logger.info "User #{this.authenticated.email} updated client with id #{clientId}"
   catch e
     logger.error "Could not update client by ID #{clientId} via the API: #{e.message}"
     this.body = e.message


  # Test if the user is authorised
  if not authorisation.inGroup 'admin', this.authenticated
    logger.info 'User ' +this.authenticated.email+ ' is not an admin, API access to updateClient denied.'
    this.body = 'User ' +this.authenticated.email+ ' is not an admin, API access to updateClient denied.'
    this.status = 'forbidden'
    return

  clientId = unescape clientId


  # Test if the user is authorised
  if not authorisation.inGroup 'admin', this.authenticated
    utils.logAndSetResponse this, 'forbidden', "User #{this.authenticated.email} is not an admin, API access to getClients denied.", 'info'
    return

  try
