private async Task <string> FindIdFromPath(string path, string artistId) { for (int page = 0; page < int.MaxValue; page++) { PagedList <ReleaseGroup> releases = await _metadataUpdater.FindAlbums(artistId, page, MusicHelper.DefaultPageSize); Album matchingAlbum = MusicHelper.FindAlbumFromFolder(path); string id = MatchAlbumByYear(releases, matchingAlbum) ?? MatchAlbumByTitle(releases, matchingAlbum); if (!string.IsNullOrEmpty(id)) { return(id); } if (!releases.HasMoreResults) { break; } } string message = string.Format("Couldn't find album of artist {0} for path: {1}", artistId, path); throw new AlbumNotFoundException(message); }