private void BuildTracksList(ref SearchResponse response, ref Utf8JsonReader reader) { var set = new HashSet <LavaTrack>(); while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndArray) { break; } if (reader.TokenType != JsonTokenType.StartObject) { continue; } var track = new LavaTrack(); while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { break; } if (reader.TokenType == JsonTokenType.PropertyName && reader.ValueTextEquals("track") && reader.Read()) { track.WithHash(reader.GetString()); } if (reader.TokenType != JsonTokenType.StartObject) { continue; } while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { break; } if (reader.TokenType != JsonTokenType.PropertyName) { continue; } if (reader.ValueTextEquals("identifier") && reader.Read()) { track.WithId(reader.GetString()); } else if (reader.ValueTextEquals("isSeekable") && reader.Read()) { track.WithSeek(reader.GetBoolean()); } else if (reader.ValueTextEquals("author") && reader.Read()) { track.WithAuthor(reader.GetString()); } else if (reader.ValueTextEquals("length") && reader.Read()) { track.WithDuration(reader.GetInt64()); } else if (reader.ValueTextEquals("isStream") && reader.Read()) { track.WithStream(reader.GetBoolean()); } else if (reader.ValueTextEquals("title") && reader.Read()) { track.WithTitle(reader.GetString()); } else if (reader.ValueTextEquals("uri") && reader.Read()) { track.WithUrl(reader.GetString()); } } } set.Add(track); } response.Tracks = set; }