         {
           filter:"(sAMAccountName=#{username})"
           scope: 'sub'
-          attributes: ["distinguishedName"]
         },
         (err, search) ->
           theUser = null
 
           search.on('searchEntry', (entry) ->
             theUser = entry.object
-            deferred.resolve(theUser.distinguishedName)
+            deferred.resolve(theUser)
           )
 
           search.on('end', (result) ->

      done(null, @)
  )

fetchDistinguishedName = (username) ->
  deferred = Q.defer()

  ldap = require('ldapjs')

userSchema.statics.createFromLDAPUsername = (username) ->
  deferred = Q.defer()

  fetchUserFromLDAP(
    username
  ).then( (user) ->
    user = new User(
      email: username
      distinguishedName: user.distinguishedName
      name: user.name
    )

    Q.nsend(
      user, 'save'
