public IHttpActionResult RemoveUrl(string url) { #region contracts if (!Regex.IsMatch(url, "")) { return(BadRequest("url is not in correct format. ")); } #endregion UrlService urlService = new UrlService(); { UrlPair urlPair = urlService.Read(url); if (urlPair is null) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.NotFound, "Not Found"); return(ResponseMessage(response)); } else { urlService.Delete(urlPair); } return(Ok(urlPair)); } }