class HubAssertionMarshaller {

    public Assertion toSaml(HubAssertion hubAssertion) {

        Assertion transformedAssertion = openSamlXmlObjectFactory.createAssertion();
        transformedAssertion.setIssueInstant(hubAssertion.getIssueInstant());
        Issuer transformedIssuer = openSamlXmlObjectFactory.createIssuer(hubAssertion.getIssuerId());
        transformedAssertion.setIssuer(transformedIssuer);
        transformedAssertion.setID(hubAssertion.getId());

        if (hubAssertion.getCycle3Data().isPresent()){
            Cycle3Dataset cycle3Data = hubAssertion.getCycle3Data().get();
            transformedAssertion.getAttributeStatements().add(transform(cycle3Data));
        }

        transformedAssertion.setSubject(outboundAssertionToSubjectTransformer.transform(hubAssertion));

        return transformedAssertion;
    }

    public  HubAssertionMarshaller(
            OpenSamlXmlObjectFactory openSamlXmlObjectFactory,
            AttributeFactory attributeFactory,
            OutboundAssertionToSubjectTransformer outboundAssertionToSubjectTransformer);

}