       mappedAccounts.push {_id: account, constructorName : "JAccount"}
     return mappedAccounts
 
+
+  mapChannel = (channel) ->
+
+    data                     = channel.channel
+    data._id                 = data.id
+    data.isParticipant       = channel.isParticipant
+    data.participantCount    = channel.participantCount
+    data.participantsPreview = mapAccounts channel.participantsPreview
+    data.unreadCount         = channel.unreadCount
+    data.lastMessage         = mapActivity channel.lastMessage  if channel.lastMessage
+
+    return new KD.remote.api.SocialChannel data
+
+
   mapChannels = (channels)->
-    return channels unless channels
-    revivedChannels = []
-    channels = [].concat(channels)
-    {SocialChannel} = KD.remote.api
-    for channel in channels
-      data                     = channel.channel
-      data._id                 = data.id
-      data.isParticipant       = channel.isParticipant
-      data.participantCount    = channel.participantCount
-      data.participantsPreview = mapAccounts channel.participantsPreview
-      data.unreadCount         = channel.unreadCount
-      data.lastMessage = mapActivity channel.lastMessage if channel.lastMessage
-      c = new SocialChannel data
-      # push channel into stack
-      revivedChannels.push c
+
+    return channels  unless channels
+
+    channels        = [].concat channels
+    revivedChannels = (mapChannel channel  for channel in channels)
+
     # bind all events
     registerAndOpenChannels revivedChannels
+
     return revivedChannels
+
+
   mapChannels: mapChannels
+
 
 
   forwardMessageEvents = (source, target,  events)->

    byId                 : channelRequesterFn
      fnName             : 'byId'
      validateOptionsWith: ['id']
      mapperFn           : mapChannels

    byName               : channelRequesterFn
      fnName             : 'byName'
      validateOptionsWith: ['name']
      mapperFn           : mapChannels

    list                 : channelRequesterFn
      fnName             : 'fetchChannels'

class SocialApiController extends KDController

  constructor: (options = {}, data) ->

    @openedChannels = {}
    @_cache         = {}

    super options, data

    KD.getSingleton('mainController').ready @bound 'openGroupChannel'


  getPrefetchedData:->

