             sourceId    : @getId()
             sourceName  : 'JAccount'
             as          : 'storage'
-            data        : {name}
-          rel.save (err)-> callback err, storage
+            data        : { name }
+          rel.save (err) -> callback err, storage
 
   fetchOrCreateAppStorage: (options, callback) ->
-    {appId, version} = options
-    @fetchAppStorage {'data.appId':appId, 'data.version':version}, (err, storage)=>
+    { appId, version } = options
+    @fetchAppStorage { 'data.appId':appId, 'data.version':version }, (err, storage) =>
       if err then callback err
       else unless storage?
         # log.info 'Creating new storage:', appId, version, @profile.nickname
-        newStorage = new JAppStorage {appId, version}
+        newStorage = new JAppStorage { appId, version }
         newStorage.save (err) =>
           if err then callback err
           else

    else
      callback new KodingError 'Access denied'

  isAuthorized: secure (client, name, callback)->
    @fetchOAuthInfo client, (err, response)->

      return callback err  if err


        SocialAccount.update {
          id            : @socialApiId
          nick          : @profile.nickname
          settings      : { shareLocation: fields.shareLocation }
        }, callback

    else
      callback new KodingError 'Access denied'


  getFullName: ->
    { firstName, lastName } = @data.profile
    return "#{firstName} #{lastName}"

  fetchStorage$: (name, callback) ->

    @fetchStorage { 'data.name' : name }, callback

  fetchStorages$: (whitelist = [], callback) ->

    options = if whitelist.length then { 'data.name' : $in : whitelist } else {}

    @fetchStorages options, callback

  store: secure (client, { name, content }, callback) ->
    unless @equals client.connection.delegate
      return callback new KodingError 'Attempt to access unauthorized storage'

    @_store { name, content }, callback

  unstore: secure (client, name, callback) ->

    unless @equals client.connection.delegate
      return callback new KodingError 'Attempt to remove unauthorized storage'

    @fetchStorage { 'data.name' : name }, (err, storage) ->
      console.error err, storage  if err
      return callback err  if err
      unless storage
        return callback new KodingError 'No such storage'

      storage.remove callback

  unstoreAll: (callback) ->
    @fetchStorages [], (err, storages) ->
      daisy queue = storages.map (storage) ->
        -> storage.remove -> queue.next()
      queue.push -> callback null

  _store: ({ name, content }, callback) ->
    @fetchStorage { 'data.name' : name }, (err, storage) =>
      if err
        return callback new KodingError 'Attempt to access storage failed'
      else if storage
        storage.update { $set: { content } }, (err) -> callback err, storage
      else
        storage = new JStorage { name, content }
        storage.save (err) =>
          return callback err  if err
          rel = new Relationship
            targetId    : storage.getId()
