Refactor DomainPattern class