public async Task AddAccessMemberAsync(IType type, TaskContext context) { var authentication = context.Authentication; if (context.AllowException == false) { if (await type.Dispatcher.InvokeAsync(() => type.IsPrivate) == false) { return; } } var userCollection = type.GetService(typeof(IUserCollection)) as IUserCollection; var member = await userCollection.GetRandomUserAsync(); var memberID = member.ID; var accessType = RandomUtility.NextEnum <AccessType>(); await type.AddAccessMemberAsync(authentication, memberID, accessType); }