private Entertainment GetEntertainmentByAttraction(Attraction attraction) { string jsonResponse = SendToServerAndGetResponseBack(new { id = attraction.id, }, "getEntertainment/"); if (jsonResponse.Equals("")) { return(null); } JObject json = JObject.Parse(jsonResponse); string className = (string)json["className"]; JObject obj = (JObject)json["object"]; if (SlidingPuzzle.isMyClassName(className)) { return(new SlidingPuzzle { id = (int)obj["id"], description = (string)obj["description"], piecesURLS = ((JArray)obj["piecesURLS"]).ToObject <List <string> >(), width = (int)obj["width"], height = (int)obj["height"] }); } else if (Puzzle.isMyClassName(className)) { return(new Puzzle { id = (int)obj["id"], description = (string)obj["description"], piecesURLS = ((JArray)obj["piecesURLS"]).ToObject <List <string> >(), width = (int)obj["width"], height = (int)obj["height"] }); } else if (TakingPicture.isMyClassName(className)) { return(new TakingPicture { id = (int)obj["id"], description = (string)obj["description"] }); } return(null); }