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: destroy_service.rb
    path of file: ./repos/Portus/app/services/tags
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Tags
  class DestroyService < ::BaseService
    attr_accessor :error

 
    
    def execute(tag)
      raise ActiveRecord::RecordNotFound if tag.nil?

      repository = tag.repository
      tag_destroyed = tag.delete_by_digest!(current_user)

      if tag_destroyed && repository.tags.empty?
        ::Repositories::DestroyService.new(current_user).execute(repository)
      else
        full_messages = !tag.errors.empty? && tag.errors.full_messages
        @error = full_messages || "Could not remove <strong>#{tag.name}</strong> tag"
      end