class ConnectorGenerator {

    protected final Connector baseConnectorFrom(final ConnectorTemplate connectorTemplate, final ConnectorSettings connectorSettings) {
        final Set<String> properties = connectorTemplate.getProperties().keySet();

        final Map<String, String> configuredProperties = connectorSettings.getConfiguredProperties()
            .entrySet().stream()
            .filter(e -> properties.contains(e.getKey()))
            .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
        configuredProperties.putAll(baseConnector.getConfiguredProperties());

        final String name = Optional.ofNullable(connectorSettings.getName())
            .orElseGet(() -> determineConnectorName(connectorTemplate, connectorSettings));

        final String description = Optional.ofNullable(connectorSettings.getDescription())
            .orElseGet(() -> determineConnectorDescription(connectorTemplate, connectorSettings));

        final Optional<ConnectorGroup> connectorGroup = connectorTemplate.getConnectorGroup();

        final String icon;
        if (connectorSettings.getIcon() != null) {
            icon = connectorSettings.getIcon();
        } else {
            icon = IconGenerator.generate(connectorTemplate.getId().get(), name);
        }

        return new Connector.Builder()
            .createFrom(baseConnector)
            .id(KeyGenerator.createKey())
            .name(name)
            .description(description)
            .icon(icon)
            .configuredProperties(configuredProperties)
            .connectorGroup(connectorGroup)
            .connectorGroupId(connectorGroup.map(ConnectorGroup::getId).orElse(Optional.empty()))
            .build();
    }

    protected  ConnectorGenerator(final Connector baseConnector);

}