'A tool shed repository is being deactivated or uninstalled, so handle
tool panel alterations accordingly.'

def remove_repository_contents(self, repository, shed_tool_conf, uninstall):

    tool_panel_dict = self.generate_tool_panel_dict_from_shed_tool_conf_entries(repository)
    repository.metadata['tool_panel_section'] = tool_panel_dict
    self.app.install_model.context.add(repository)
    self.app.install_model.context.flush()
    guids_to_remove = list(tool_panel_dict.keys())
    self.remove_guids(guids_to_remove, shed_tool_conf, uninstall)
