private void ExtractPlayers(HtmlNodeCollection playerElements, int teamId) { for (var playerIdx = 0; playerIdx < playerElements.Count; playerIdx++) { var item = playerElements[playerIdx]; const int sourceIdInHref = 7; var sourceId = item.Attributes["href"].Value.Split('/')[sourceIdInHref]; var playerName = item.InnerText; playerName = ScrapeHelper.FormatPlayerName(playerName); Logger.Information($"SourceId {sourceId}, PlayerName {playerName}, TeamId {teamId}"); if (string.IsNullOrEmpty(sourceId) || string.IsNullOrEmpty(playerName)) { Logger.Warning($"SourceId {sourceId} or PlayerName {playerName} " + $"is null or empty at index {playerIdx}"); continue; } Players.Add(new Player { SourceId = sourceId, Name = playerName, TeamId = teamId }); } }