def save_checkpoint(
        self,
        state,
        data,
        endpoint,
        table_name,
        checkpoint_key=None,
        value=None,
        company_name_flag=False,
    ):
        """Save checkpoint data into the state.

        Args:
            state (StateManager): StateManager instance.
            data (dict): Data to be saved in the checkpoint.
            endpoint (str): Endpoint for which the checkpoint is being saved.
            table_name (str): Table name for which the checkpoint is being saved.
            checkpoint_key (str): Checkpoint key.
            value (str): Value to be set in the checkpoint key.
            company_name_flag (bool): Flag indicating if the company name is used.

        Raises:
            BitSightException: Raised for any exception during checkpoint saving.
        """
        try:
            if company_name_flag:
                company_data = {"company_name": data}
                state.post(json.dumps(company_data))
                self.save_checkpoint_to_sentinel("company_name", data, table_name)
                applogger.info(
                    "{} save_checkpoint: {} -> {} successfully posted data.".format(LOGS_STARTS_WITH, endpoint, data)
                )
            else:
                if data is None:
                    data = {}
                data[checkpoint_key] = value
                self.save_checkpoint_to_sentinel(checkpoint_key, value, table_name)
                state.post(json.dumps(data))
                applogger.debug(
                    "BitSight: save_checkpoint: {}: {}: Posted Data: {}".format(
                        endpoint, checkpoint_key, data[checkpoint_key]
                    )
                )
        except Exception as err:
            applogger.exception("BitSight: SAVE CHECKPOINT: {}".format(err))
            raise BitSightException()
Save checkpoint data into the state.

        Args:
            state (StateManager): StateManager instance.
            data (dict): Data to be saved in the checkpoint.
            endpoint (str): Endpoint for which the checkpoint is being saved.
            table_name (str): Table name for which the checkpoint is being saved.
            checkpoint_key (str): Checkpoint key.
            value (str): Value to be set in the checkpoint key.
            company_name_flag (bool): Flag indicating if the company name is used.

        Raises:
            BitSightException: Raised for any exception during checkpoint saving.
        
Solutions/BitSight/Data Connectors/BitSightDataConnector/SharedCode/utils.py