mergeLayer (hrService) {
    const currentGroup = this.current_layer.getGroup()
    const prevGroup = currentGroup.previousElementSibling
    if (!prevGroup) {
      return
    }

    hrService.startBatchCommand('Merge Layer')

    const layerNextSibling = currentGroup.nextSibling
    hrService.removeElement(currentGroup, layerNextSibling, this.svgElem_)

    while (currentGroup.firstChild) {
      const child = currentGroup.firstChild
      if (child.localName === 'title') {
        hrService.removeElement(child, child.nextSibling, currentGroup)
        child.remove()
        continue
      }
      const oldNextSibling = child.nextSibling
      prevGroup.append(child)
      hrService.moveElement(child, oldNextSibling, currentGroup)
    }

    // Remove current layer's group
    this.current_layer.removeGroup()
    // Remove the current layer and set the previous layer as the new current layer
    const index = this.indexCurrentLayer()
    if (index > 0) {
      const name = this.current_layer.getName()
      this.current_layer = this.all_layers[index - 1]
      this.all_layers.splice(index, 1)
      delete this.layer_map[name]
    }

    hrService.endBatchCommand()
  }
@param {module:history.HistoryRecordingService} hrService
@returns {void}