     @tabView.addPane pane
     @activeTabIndex = @tabView.panes.length
 
+    workspaceRefData =
+      sessionKey : editor.sessionKey
+
+    if file
+      workspaceRefData.path = file.path
+      @openedFiles.push file.path
+
+    @workspaceRef.child("tabs").push workspaceRefData  unless sessionKey
+
     pane.on "KDTabPaneDestroy", =>
       @workspaceRef.once "value", (snapshot) =>
         {tabs} = snapshot.val()

        @tabView.showPaneByIndex val.ActiveTabIndex
        return @workspaceRef.child("ActiveTabIndex").remove()

      {tabs} = val
      return unless tabs

      for key, data of tabs
        if data.path and @openedFiles.indexOf(data.path) is -1
          file = FSHelper.createFileFromPath data.path
          @createEditorInstance file, null, data.sessionKey

    @workspaceRef.onDisconnect().remove()  if @workspace.amIHost()

  createEditorTabs: ->
    @tabHandleContainer = new ApplicationTabHandleHolder
      delegate      : @
      addPlusHandle : no

    @tabView = new ApplicationTabView
      delegate           : @

        @workspaceRef.set { tabs }

      @openedFiles.splice @openedFiles.indexOf(file.path), 1

    return yes # return something instead of workspaceRef.child

