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: image.rb
    path of file: ./repos/open-build-service/src/api/app/models/kiwi
    
    the code of the file until where you have to start completion: require 'pretty_nested_errors'

module Kiwi
  class Image < ApplicationRecord
    #### In
    
    def write_to_backend
      return false unless package

      Package.transaction do
        file_name = package.kiwi_image_file || "#{package.name}.kiwi"
        package.save_file(filename: file_name, file: to_xml)
        self.md5_last_revision = package.kiwi_file_md5
        save!
      end
    end