         _id: 0
         name: 1
     else
-      logger.info "The property (#{property}) you are trying to retrieve is not found."
-      this.body = "The property (#{property}) you are trying to retrieve is not found."
-      this.status = 'not found'
+      utils.logAndSetResponse this, 'not found', "The property (#{property}) you are trying to retrieve is not found.", 'info'
       return
   else
     # 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 findClientById denied."
-      this.body = "User #{this.authenticated.email} is not an admin, API access to findClientById denied."
-      this.status = 'forbidden'
+      utils.logAndSetResponse this, 'forbidden', "User #{this.authenticated.email} is not an admin, API access to findClientById denied.", 'info'
       return
 
   clientId = unescape clientId

  try
    result = yield Client.findOne(clientDomain: clientDomain).exec()
    if result is null
      this.body = "Could not find client with clientDomain #{clientDomain}"
      this.status = 'not found'
    else
      this.body = result
  catch e

Q = require 'q'
logger = require 'winston'
authorisation = require './authorisation'
utils = require '../utils'

###
# Adds a client
