class UnassignNetworkBB {

    public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) {
        try {
            L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
            AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
            Optional<org.onap.aai.domain.yang.L3Network> network =
                    aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
            if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
                String msg = messageCannotPerformUnassign + relatedToValue;
                execution.setVariable("ErrorUnassignNetworkBB", msg);
                logger.error("ErrorUnassignNetworkBB: {}", msg);
                throw new UnassignNetworkException(msg);
            }
        } catch (Exception ex) {
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
        }
    }

}