insertAuthor (data, currentAuthor) {
    const editorSession = this.api.getEditorSession()
    const doc = editorSession.getDocument()
    const root = doc.root
    let insertPos = root.authors.length
    if (currentAuthor) {
      insertPos = currentAuthor.getPosition() + 1
    }
    const nodeData = Object.assign({}, data, { type: 'author' })
    // prune empty middlenames
    nodeData.middleNames = nodeData.middleNames.filter(Boolean)
    if (nodeData.affiliations && nodeData.affiliations.length > 0) {
      if (!isString(nodeData.affiliations[0])) {
        throw new Error('Affiliations must be given as ids')
      }
    }
    this.api.insertNode([root.id, 'authors'], insertPos, nodeData)
  }
@param {object} data from AuthorModal state