def restore_scheduled_view(self, SVListWidget, url, id, key):
        logger.info("Restoring SV(s)")
        if SVListWidget.updated == True:

            filter = "JSON (*.json)"
            filelist, status = QtWidgets.QFileDialog.getOpenFileNames(self, "Open file(s)...", os.getcwd(),
                                                                      filter)
            if len(filelist) > 0:
                sumo = SumoLogic(id, key, endpoint=url)
                for file in filelist:
                    try:
                        with open(file) as filepointer:
                            sv_backup = json.load(filepointer)
                    except Exception as e:
                        logger.exception(e)
                        self.mainwindow.errorbox(
                            "Something went wrong reading the file. Do you have the right file permissions? Does it contain valid JSON?")
                        return
                    try:
                        local_time = datetime.now(timezone.utc).astimezone()
                        status = sumo.create_scheduled_view(sv_backup['indexName'], sv_backup['query'], local_time.isoformat())

                    except Exception as e:
                        logger.exception(e)
                        self.mainwindow.errorbox('Something went wrong:\n\n' + str(e))
                        return
                self.update_SV_list(SVListWidget, url, id, key)


            else:
                self.mainwindow.errorbox("Please select at least one file to restore.")
                return
        else:
            self.mainwindow.errorbox("Please update the directory list before restoring content")
        return
    def copy_scheduled_view(self, SVListWidgetFrom, SVListWidgetTo, fromurl, fromid, fromkey,
                  tourl, toid,
                  tokey):

        logger.info("Copying SV(s)")
        try:
            selecteditems = SVListWidgetFrom.selectedItems()
            if len(selecteditems) > 0:  # make sure something was selected
                fromsumo = SumoLogic(fromid, fromkey, endpoint=fromurl)
                tosumo = SumoLogic(toid, tokey, endpoint=tourl)
                for selecteditem in selecteditems:
                    for object in SVListWidgetFrom.currentcontent:
                        if object['indexName'] == str(selecteditem.text()):
                            item_id = object['id']
                            scheduled_views_export = fromsumo.get_scheduled_view(item_id)
                            local_time = datetime.now(timezone.utc).astimezone()
                            status = tosumo.create_scheduled_view(scheduled_views_export['indexName'], scheduled_views_export['query'], local_time.isoformat() )
                self.update_SV_list(SVListWidgetTo, tourl, toid, tokey)
                return

            else:
                self.mainwindow.errorbox('You have not made any selections.')
                return

        except Exception as e:
            logger.exception(e)
            self.mainwindow.errorbox('Something went wrong:' + str(e))
            self.update_SV_list(SVListWidgetTo, tourl, toid, tokey)
        return