You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: issue_writer.rb
    path of file: ./repos/openproject/modules/bim/lib/open_project/bim/bcf_xml
    
    the code of the file until where you have to start completion: ##
# Creates or updates a BCF issue and markup from a work package
module OpenProject::Bim::BcfXml
  class IssueWriter < BaseWriter
    attr_reader :work_package, :issue, :markup_doc, :markup_node

    TOPIC_SEQUENCE = [
      "ReferenceLink",
      "Title",
      "Priority",
      "Index",
      "Labels",
      "CreationDate",
      "CreationAuthor",
      "ModifiedDate",
      "ModifiedAuthor",
      "DueDate",
      "AssignedTo",
      "Stage",
      "Description",
      "BimSnippet",
      "DocumentReference",
      "RelatedTopic"
    ].freeze

    def self.update_from!(work_package)
      writer = new(work_package)
      writer.update

      writer.issue
    end

    def initialize(work_package)
      @work_package = work_package
      @issue = find_or_initialize_issue

      # Create markup document
      super()

      # Remember root markup node for easier access

    
    def initialize(work_package)
      @work_package = work_package
      @issue = find_or_initialize_issue

      # Create markup document
      super()

      # Remember root markup node for easier access
      @markup_node = markup_doc.at_xpath('/Markup')
    end

    def update
      # update or create topic node
      topic

      # Override all current comments
      replace_comments

      # Override all current Viewpoints
      replace_viewpoints

      # Replace the markup XML
      issue.markup = markup_doc.to_xml(indent: 2)

      # Save issue and potential new associations
      issue.save!
    end

    protected

    def root_node
      :Markup
    end

    ##
    # Get the nokogiri document from the markup xml
    def build_markup_document
      if issue.markup
        Nokogiri::XML issue.markup, &:noblanks
      else
        super
      end
    end

    ##
    # Update the topic node, or create it
    def topic
      topic_node = fetch(markup_node, 'Topic')

      topic_attributes      topic_node

      topic_reference_link  topic_node
      topic_title           topic_node
      topic_priority        topic_node
      topic_creation_date   topic_node
      topic_creation_author topic_node
      topic_modified_date   topic_node
      topic_modified_author topic_node
      topic_due_date        topic_node
      topic_assigned_to     topic_node
      topic_description     topic_node

      enforce_child_order(topic_node, TOPIC_SEQUENCE)
    end

    def enforce_child_order(parent_node, sequence)
      children_by_name = parent_node
        .children
        .select(&:element?)
        .group_by(&:name)

      sequence.reverse_each do |name|
        if children_with_name = children_by_name[name]
          children_with_name.each do |child|
            parent_node.delete child
            prepend_into_or_insert(parent_node, child)
          end
        end
      end
    end