public List <UserDTO> GetAllUsers() { List <UserDTO> usersDTO = new List <UserDTO>(); try { List <User> usersResult = _directoryService.GetAllUsers(); foreach (User user in usersResult) { usersDTO.Add(new UserDTO() { FirstName = user.FirstName, LastName = user.LastName, Email = user.EmailAddress, PID = user.PayId.Identity }); } } catch (Exception ex) { _logger.ErrorException("Unable to get list of users from AD", ex); } _logger.Trace(LoggerHelper.ExecutedFunctionMessage(usersDTO)); return(usersDTO); }