public async Task <HttpResponseMessage> AddAsync(User user) { HttpResponseMessage response; try { if (_userBusiness.ValidateUser(user)) { _userBusiness.Add(user); await _userBusiness.ApplyChagesAsync(); response = Request.CreateResponse(); response.Content = new ObjectContent <User>(user, fJsonMTF, Consts.C_MT_JSON); } else { response = Request.CreateResponse(HttpStatusCode.BadRequest); response.ReasonPhrase = Consts.VALIDATION_ERROR_RESPONSE_PHRASE; response.Content = new StringContent(Consts.INVALID_USER_DATA); } } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError); response.ReasonPhrase = ExceptionUtils.GetErrorMessages(ex); } return(response); }