       { delegate } = client.connection
       { accountId, currentPassword, slug } = options
 
+      clientAccountId = delegate.getId()
+
       return callback new KodingError 'User is not selected!'  unless accountId
 
-      if delegate.getId().equals accountId
+      if clientAccountId.equals accountId
         return callback new KodingError 'You cannot transfer ownership to yourself, concentrate and try again!'
 
+      @checkUserPassword delegate, currentPassword, (err) =>
+
+        return callback new KodingError err  if err
+
+        @transferOwnership { clientAccountId, accountId, slug }, callback
+
+
+  transferOwnership: (options, callback) ->
+
+    { clientAccountId, accountId, slug } = options
+
+    return callback new KodingError 'Account is not provided'  unless accountId
+
+    @fetchOwner (err, owner) =>
+
+      return callback err if err
+
+      if clientAccountId and JSON.stringify(clientAccountId) isnt JSON.stringify(owner.getId())
+
+        return callback new KodingError 'You must be the owner to perform this action!'
+
       Relationship.one {
-        targetId: delegate.getId(),
+        targetId: owner.getId()
         sourceId: @getId(),
         as      : 'owner'
-      }, (err, owner) =>
-
-        return callback err if err
-        return callback new KodingError 'You must be the owner to perform this action!' unless owner
-
-        @checkUserPassword delegate, currentPassword, (err) =>
-
-          return callback new KodingError err  if err
-
-          JAccount = require '../account'
-          JAccount.one { _id: accountId }, (err, account) =>
+      }, (err, ownershipRelation) =>
+
+        JAccount = require '../account'
+        JAccount.one { _id: accountId }, (err, account) =>
+
+          return callback err if err
+
+          @fetchRolesByAccount account, (err, newOwnersRoles) =>
+
             return callback err if err
 
-            unless account.type is 'registered'
-              return callback new KodingError 'You cannot transfer ownership to this account'
-
-            @fetchRolesByAccount account, (err, newOwnersRoles) =>
-              return callback err if err
-
-              kallback = (err) ->
-                callback err
-
-              # give rights to new owner
-              queue = difference(['member', 'admin'], newOwnersRoles).map (role) => (fin) =>
-                @addMember account, role, fin
-
-              async.parallel queue, (err) ->
-                return kallback err  if err
-
-                # notify group for new owner
-                contents =
-                  role: 'owner'
-                  id: accountId
-                  group: slug
-                  adminNick: account.profile.nickname
-
-                JGroup.one { slug }, (err, group) ->
-                  if group
-                    group.sendNotification 'MembershipRoleChanged', contents
-
-                  # transfer ownership
-                  owner.update { $set: { targetId: account.getId() } }, kallback
+            if 'blockedAccount' in newOwnersRoles
+              return callback new KodingError 'You cannot transfer ownership to blocked account'
+
+            kallback = (err) ->
+              callback err
+
+            # give rights to new owner
+            queue = difference(['member', 'admin'], newOwnersRoles).map (role) => (fin) =>
+              @addMember account, role, fin
+
+            async.parallel queue, (err) ->
+              return kallback err  if err
+
+              slug ?= 'koding'
+
+              # notify group for new owner
+              contents =
+                role: 'owner'
+                id: accountId
+                group: slug
+                adminNick: owner.profile.nickname
+
+              JGroup.one { slug }, (err, group) ->
+                if group
+                  group.sendNotification 'MembershipRoleChanged', contents
+
+                ownershipRelation.update { $set: { targetId: account.getId() } }, kallback
 
 
   ensureUniquenessOfRoleRelationship:(target, options, fallbackRole, roleUnique, callback) ->

      else
        callback()


  transferOwnership: permit
    advanced: [
      { permission: 'grant permissions' }
      { permission: 'grant permissions', superadmin: yes }

    @ensureUniquenessOfRoleRelationship target, options, 'owner', yes, (err) =>
      if err then callback err
      else oldAddOwner.call this, target, options, callback


  destroy$   : permit
