def _parse_results(self, results):
    param = self._base_connector.get_current_param()
    container_count = EWS_DEFAULT_CONTAINER_COUNT
    artifact_count = EWS_DEFAULT_ARTIFACT_COUNT
    if param:
        container_count = param.get(phantom.APP_JSON_CONTAINER_COUNT, EWS_DEFAULT_CONTAINER_COUNT)
        artifact_count = param.get(phantom.APP_JSON_ARTIFACT_COUNT, EWS_DEFAULT_ARTIFACT_COUNT)
    results = results[:container_count]
    for result in results:
        container = result.get('container')
        if (not container):
            continue
        container.update(_container_common)
        try:
            (ret_val, message, container_id) = self._base_connector.save_container(container)
        except Exception as e:
            self._base_connector.debug_print('Exception: ', e)
            continue
        self._base_connector.debug_print(PROC_EMAIL_SAVE_CONTAINER.format(ret_val, message, container_id))
        if phantom.is_fail(ret_val):
            message = PROC_EMAIL_FAILED_CONTAINER.format(container['source_data_identifier'], message)
            self._base_connector.debug_print(message)
            continue
        if (not container_id):
            message = PROC_EMAIL_SAVE_CONTAINER_FAILED
            self._base_connector.debug_print(message)
            continue
        files = result.get('files')
        vault_artifacts_added = 0
        for curr_file in files:
            (ret_val, added_to_vault) = self._handle_file(curr_file, container_id)
            if added_to_vault:
                vault_artifacts_added += 1
        artifacts = result.get('artifacts')
        if (not artifacts):
            continue
        if (not self._base_connector.is_poll_now()):
            artifacts = artifacts[:artifact_count]
        len_artifacts = len(artifacts)
        for (j, artifact) in enumerate(artifacts):
            if (not artifact):
                continue
            artifact['container_id'] = container_id
            self._set_sdi(artifact)
            if ((j + 1) == len_artifacts):
                artifact['run_automation'] = True
            (ret_val, status_string, artifact_id) = self._base_connector.save_artifact(artifact)
            self._base_connector.debug_print(PROC_EMAIL_SAVE_CONT_PASSED.format(ret_val, status_string, artifact_id))
    [shutil.rmtree(x['temp_directory'], ignore_errors=True) for x in results if x.get('temp_directory')]
    return self._base_connector.set_status(phantom.APP_SUCCESS)
def _parse_results(self, results):
    param = self._base_connector.get_current_param()
    container_count = EWS_DEFAULT_CONTAINER_COUNT
    artifact_count = EWS_DEFAULT_ARTIFACT_COUNT
    if param:
        container_count = param.get(phantom.APP_JSON_CONTAINER_COUNT, EWS_DEFAULT_CONTAINER_COUNT)
        artifact_count = param.get(phantom.APP_JSON_ARTIFACT_COUNT, EWS_DEFAULT_ARTIFACT_COUNT)
    results = results[:container_count]
    for result in results:
        container = result.get('container')
        if (not container):
            continue
        container.update(_container_common)
        try:
            (ret_val, message, container_id) = self._base_connector.save_container(container)
        except Exception as e:
            self._base_connector.debug_print('Exception: ', e)
            continue
        self._base_connector.debug_print(PROC_EMAIL_SAVE_CONTAINER.format(ret_val, message, container_id))
        if phantom.is_fail(ret_val):
            message = PROC_EMAIL_FAILED_CONTAINER.format(container['source_data_identifier'], message)
            self._base_connector.debug_print(message)
            continue
        if (not container_id):
            message = PROC_EMAIL_SAVE_CONTAINER_FAILED
            self._base_connector.debug_print(message)
            continue
        files = result.get('files')
        vault_artifacts_added = 0
        for curr_file in files:
            (ret_val, added_to_vault) = self._handle_file(curr_file, container_id)
            if added_to_vault:
                vault_artifacts_added += 1
        artifacts = result.get('artifacts')
        if (not artifacts):
            continue
        if (not self._base_connector.is_poll_now()):
            artifacts = artifacts[:artifact_count]
        len_artifacts = len(artifacts)
        for (j, artifact) in enumerate(artifacts):
            if (not artifact):
                continue
            artifact['container_id'] = container_id
            self._set_sdi(artifact)
            if ((j + 1) == len_artifacts):
                artifact['run_automation'] = True
            (ret_val, status_string, artifact_id) = self._base_connector.save_artifact(artifact)
            self._base_connector.debug_print(PROC_EMAIL_SAVE_CONT_PASSED.format(ret_val, status_string, artifact_id))
    [shutil.rmtree(x['temp_directory'], ignore_errors=True) for x in results if x.get('temp_directory')]
    return self._base_connector.set_status(phantom.APP_SUCCESS)