private static async Task <bool> CheckGroupAlbumIdentifierExistsForGroupAsync( string groupAlbumIdentifier, Guid userId, IGroupAlbumRepository groupAlbumRepository) { var group = await groupAlbumRepository.CheckExistsByIdentifierAndGroupIdAsync(groupAlbumIdentifier, userId); return(group != null); }
private static async Task <string> GenerateNewGroupAlbumIdentifierAsync( Guid groupId, IGroupAlbumRepository groupAlbumRepository) { var newGroupAlbumIdentifier = ModelHelpers.GenerateUniqueIdentifier(IdentifierConsts.GroupIdentifierLength); var groupAlbumIdentifierExistsForGroup = await CheckGroupAlbumIdentifierExistsForGroupAsync( newGroupAlbumIdentifier, groupId, groupAlbumRepository).ConfigureAwait(false); if (groupAlbumIdentifierExistsForGroup) { return(await GenerateNewGroupAlbumIdentifierAsync(groupId, groupAlbumRepository).ConfigureAwait(false)); } else { return(newGroupAlbumIdentifier); } }