public string Filter([FromUri] string action, [FromBody] object value) { ResultObject resultt = new ResultObject(); try { if (value != null) { if ("filter".Equals(action)) { try { var filterObject = JsonConvert.DeserializeObject <ExamFilterModel>(value.ToString()); return(JsonConvert.SerializeObject(services.Filter(filterObject), Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); } catch (Exception ex) { return("Object fillter not convert valid"); } } } if ("getfilter".Equals(action)) { return(JsonConvert.SerializeObject(services.listFilters())); } var result = services.GetAll().ToList(); return(JsonConvert.SerializeObject(result, Formatting.Indented, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore })); } catch (Exception e) { resultt.Message = "EXCEPTION: " + e.Message + "Stack: " + e.StackTrace; return(JsonConvert.SerializeObject(resultt)); } }