private IUser Convert(LdapEntry entry) { if (null == entry) { return(null); } User user = new User { DistinguishedName = entry.Dn, DisplayName = entry.Attribute("displayName"), Email = entry.Attribute("mail"), FirstName = entry.Attribute("givenName"), LastName = entry.Attribute("sn"), Username = entry.Attribute("sAMAccountName"), Roles = entry.ArrayAttribute("memberOf").Where(r => roles.Contains(r)).ToList() }; return(user); }