private async Task <uint> GetTrackCount(IArtist artist) { uint offset = 0; uint fetchCount = 50; uint trackCount = 0; while (true) { foreach (var album in await artist.Albums(CancellationToken.None, offset, fetchCount)) { await Task.Delay(_delayConfiguration.CheckArtistForUpdatesBackgroundJob_GetTrackCountDelay); var apiAlbum = await _deezerApiService.GetDeezerApi().Albums.GetById(album.Id, CancellationToken.None); trackCount += apiAlbum.TrackCount; } if (offset >= artist.NumberOfAlbums) { break; } offset += fetchCount; } return(trackCount); }