             cssClass  : "introduction-snippet-switch snippet"
             click     : => @switchMode()
 
-    options.fields  = itemFields
-    if options.type is "Group"
-      if options.actionType is "Insert"
-        groupFields[key] = field for key, field of itemFields
-      options.fields = groupFields
+    options.fields = if options.type is "Group" then groupFields else itemFields
 
     options.buttons =
       "Save"          :


  createPostData: ->
    {inputs}     = @
    options      = @getOptions()
    {type}       = options
    {actionType} = options
    itemData     = {}

    snippet = @aceEditor?.getValue()
    if @snippetType is "Text"
      snippet = """new KDView({partial: "#{@aceEditor?.getValue()}"});"""

    if type is "Item" or (type is "Group" and actionType is "Insert")
      itemData = {
        introId    : inputs.IntroId.getValue()
        introTitle : inputs.IntroTitle.getValue()
        snippet
      }

    if type is "Group"
      data = {
        title      : inputs.Title.getValue()
        expiryDate : inputs.ExpiryDate.getValue()
        visibility : inputs.Visibility.getValue()
        overlay    : inputs.Overlay.getValue()
      }
      data.snippets = [ itemData ] if actionType is "Insert"
      return data

    return itemData

  setVisibilityOfOverlayWarning: (isShowing) ->
    @warningView = @warningView or @fields?.warning.getSubViews()[1].getSubViews()[0]

      @updateChild()

  insertParent: ->
    data = @createPostData()
    if not @getOptions().addingToAGroup
      @destroy()
      @getDelegate().showForm "Item", data, "Insert", yes
    else
      @parentData.snippets.push data
      KD.remote.api.JIntroSnippet.create @parentData, =>
        @buttons["Save"].hideLoader()
        @emit "IntroductionFormNeedsReload"

  insertChild: ->
    @parentData.addChild @createPostData(), =>
