protected virtual async Task <T> MapAsync(IMember member) { var relatedUserId = member.GetValueOrDefault <int>(ProfileConstants.RelatedUser); var photo = member.GetValueOrDefault <int?>(ProfileConstants.Photo); var relatedUser = await _intranetUserService.GetByIdAsync(relatedUserId); var memberPhotoId = photo ?? member.GetMemberImageId(ProfileConstants.Photo); var memberPhotoUrl = _contentHelper.EnsureUmbracoContext(ctx => ctx.Media.GetById(memberPhotoId.GetValueOrDefault())?.Url); var memberGroups = _intranetMemberGroupService.GetForMember(member.Id).ToArray(); var mappedMember = new T { Id = member.Key, Email = member.Email, LoginName = member.Username, Groups = memberGroups, Inactive = member.IsLockedOut, RelatedUser = relatedUser, IsSuperUser = relatedUser.IsSuperUser && memberGroups.Any(g => g.Name is GroupWebMaster), Photo = GetUserPhotoOrDefaultAvatar(memberPhotoUrl), PhotoId = memberPhotoId, UmbracoId = member.Id }; return(mappedMember); }