public HttpResponseMessage DeleteUsers(string userID) { string callerMethodName = string.Empty; try { InsightLogger.TrackEvent("PersonalizationAPIController :: Delete method, endpoint - api / personalizationapi / users /" + userID); //Get Caller Method name from CallerInformation class callerMethodName = CallerInformation.TrackCallerMethodName(); //check if userid is null if (!string.IsNullOrEmpty(userID)) { Personalization personalization = new Personalization(); InsightLogger.TrackEvent("PersonalizationAPIController :: Deleting user"); UserEntity deleteUserEntity = personalization.DeleteUser(userID); //if user deleted returns ok otherwise not found if (deleteUserEntity != null) { return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(Request.CreateResponse(HttpStatusCode.NotFound)); } } else { InsightLogger.TrackEvent("PersonalizationAPIController ::user does not exist to delete"); return(Request.CreateResponse(HttpStatusCode.BadRequest)); } } catch (DataAccessException dalexception) { InsightLogger.Exception(dalexception.Message, dalexception, callerMethodName); return(Request.CreateResponse(HttpStatusCode.NotFound, DataProvider.PersonalizationResponseError <UserDTO>("400", dalexception.Message, dalexception.Message))); } catch (BusinessLogicException blexception) { InsightLogger.Exception(blexception.Message, blexception, callerMethodName); return(Request.CreateResponse(HttpStatusCode.NotFound, DataProvider.PersonalizationResponseError <UserDTO>("400", blexception.Message, blexception.Message))); } catch (Exception exception) { InsightLogger.Exception(exception.Message, exception, callerMethodName); //LoggerHelper.WriteToLog(exception + " - exception in controller action while deleting user : "******"400", exception.Message, exception.StackTrace))); } }