def METHOD_NAME(
    self, entity_urn: str, aspect_name: str, aspect: Optional[Aspect]
) -> Optional[Aspect]:
    in_domain_aspect: DomainsClass = cast(DomainsClass, aspect)
    domain_aspect = DomainsClass(domains=[])
    # Check if we have received existing aspect
    if in_domain_aspect is not None and self.config.replace_existing is False:
        domain_aspect.domains.extend(in_domain_aspect.domains)
    domain_to_add = self.config.get_domains_to_add(entity_urn)
    domain_aspect.domains.extend(domain_to_add.domains)
    if self.config.semantics == TransformerSemantics.PATCH:
        assert self.ctx.graph
        patch_domain_aspect: Optional[
            DomainsClass
        ] = AddDatasetDomain._merge_with_server_domains(
            self.ctx.graph, entity_urn, domain_aspect
        )
        return cast(Optional[Aspect], patch_domain_aspect)
    return cast(Optional[Aspect], domain_aspect)