public HttpResponseMessage CheckToken(Guid token) { HttpResponseMessage requestMsg = null; if (token == null) { ModelState.AddModelError("", "You did not add token!"); } if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } bool validToken = passwordResetService.CheckToken(token); if (validToken) { requestMsg = Request.CreateResponse(HttpStatusCode.OK, new SuccessResponse()); } else { requestMsg = Request.CreateResponse(HttpStatusCode.BadRequest, "Token is invalid"); } return(requestMsg); }