public dynamic GetNumberOfVisitors(dynamic node) { try { // Try casting to a segment var segment = JsonConvert.DeserializeObject <NcbtSegment>(((JObject)node).ToString()); // Return all visitors matching the segment return(new { totalNumberOfVisitors = TrackingManager.CountVisitors(), numberOfmatchingVisitors = TrackingManager.CountVisitorsInSegmentInternal(node) }); } catch (Exception e) { return(e); } }