/// <summary>
 /// Validates the response from the server.
 /// </summary>
 /// <param name="response"></param>
 private Response ValidateResponse(Response response)
 {
     // If the result has not been set (i.e is Unknown) then assume we have a failure
     if ((response.Result == ResponseResult.Failure) || (response.Result == ResponseResult.Unknown))
     {
         string message = "Request processing has failed on the remote server:" + Environment.NewLine +
             response.ConcatenateErrors();
         var errorType = response.ErrorMessages.Count == 1 ?
             response.ErrorMessages[0].Type :
             null;
         throw new CommunicationsException(message, errorType);
     }
     return response;
 }
 /// <summary>
 /// Validate the response from the server.
 /// </summary>
 /// <param name="response"></param>
 private void ValidateResponse(Response response)
 {
     if (response.Result == ResponseResult.Failure)
 {
         string message = "Request request has failed on the remote server:" + Environment.NewLine +
             response.ConcatenateErrors();
         throw new CruiseControlException(message);
 }
 }