def METHOD_NAME(config, app, colin_db_engine: engine, db_lear, unaffiliated_firm: dict):
    logger = prefect.get_run_logger()
    status_service = ProcessingStatusService(config.DATA_LOAD_ENV, colin_db_engine)
    with app.app_context():
        try:
            account_id = unaffiliated_firm.get('account_id')
            account_svc_affiliate_url = f'{config.AUTH_SVC_URL}/orgs/{account_id}/affiliations'
            token = AccountService.get_bearer_token()
            corp_num = unaffiliated_firm.get('corp_num')
            business = Business.find_by_identifier(corp_num)
            pass_code = get_firm_affiliation_passcode(business)
            # Create an account:business affiliation
            affiliate_data = json.dumps({
                'businessIdentifier': corp_num,
                'passCode': pass_code
            })
            affiliate = requests.post(
                url=account_svc_affiliate_url,
                headers={**AccountService.CONTENT_TYPE_JSON,
                         'Authorization': AccountService.BEARER + token},
                data=affiliate_data,
                timeout=AccountService.timeout
            )
            if affiliate.status_code != 201:
                error_msg = f"""error affiliating {corp_num} to account {account_id}.
                            Affiliation status code: {affiliate.status_code} - {affiliate.text}
                            """
                raise CustomException(f'{error_msg}', unaffiliated_firm)
            # push contact info
            if contact_info := unaffiliated_firm.get('contact_info'):
                business_profile.update_business_profile(business, contact_info)
            status_service.update_status(corp_num=corp_num,
                                              account_id=account_id,
                                              processed_status=ProcessingStatuses.COMPLETED)
        except CustomUnsupportedTypeException as err:
            error_msg = f'Custom error for corp_num={corp_num}, account id={account_id}, {err}'
            logger.error(error_msg)
            status_service.update_status(corp_num=corp_num,
                                         account_id=account_id,
                                         processed_status=ProcessingStatuses.FAILED,
                                         last_error=error_msg)
            raise err
        except Exception as err:
            error_msg = f'error affiliating business {corp_num}, {account_id}, {err}'
            logger.error(error_msg)
            status_service.update_status(corp_num=corp_num,
                                              account_id=account_id,
                                              processed_status=ProcessingStatuses.FAILED,
                                              last_error=error_msg)
            raise err