public HttpResponseMessage GetById(string fileName, int id) { logger.Info("The request came. Method: '{0}', Request path: '{1}', File name: '{2}', Id: '{3}'", Request.Method, Request.RequestUri.AbsolutePath, fileName, id); var path = GetRepoPath(fileName); try { return(Request.CreateResponse <TradeRecord>(HttpStatusCode.OK, logic.GetById(path, id))); } catch (Exception e) { logger.Error(e.Message); return(Request.CreateResponse <string>(HttpStatusCode.BadRequest, e.Message)); } }