class CustomDataSourceResourceConverter extends ResourceConverterImpl<CustomReportDataSource, ClientCustomDataSource> {

    @Override
    protected CustomReportDataSource resourceSpecificFieldsToServer(ClientCustomDataSource clientObject, CustomReportDataSource resultToUpdate, List<Exception> exceptions, ToServerConversionOptions options) throws IllegalParameterValueException {
        resultToUpdate.setDataSourceName(clientObject.getDataSourceName());
        final CustomDataSourceDefinition definition = customDataSourceFactory.getDefinitionByName(clientObject.getDataSourceName());
        // let's fill service class by dataSourceName. If dataSourceName is incorrect and no such definition,
        // then let validator throw corresponding error
        if (definition != null) {
            // service class attribute is read only. It's determined by dataSourceName
            resultToUpdate.setServiceClass(definition.getServiceClassName());
        }
        Map<String, Object> properties = new HashMap<String, Object>();
        final Map resultToUpdatePropertyMap = resultToUpdate.getPropertyMap();
        if (resultToUpdatePropertyMap != null && !resultToUpdatePropertyMap.isEmpty()) {
            // put all properties to ignore (if any exists) to the result properties map
            for (String currentPropertyToIgnore : propertiesToIgnore) {
                if (resultToUpdatePropertyMap.containsKey(currentPropertyToIgnore)) {
                    properties.put(currentPropertyToIgnore, resultToUpdatePropertyMap.get(currentPropertyToIgnore));
                }
            }
        }
        // put all the properties, received from the client
        final List<ClientProperty> clientProperties = clientObject.getProperties();
        if (clientProperties != null && !clientProperties.isEmpty()) {
            for (ClientProperty property : clientProperties) {
                final String propertyKey = property.getKey();
                final String propertyValue = property.getValue();
                if ((propertiesToIgnore.contains(propertyKey) && propertyValue != null)
                        || !propertiesToIgnore.contains(propertyValue)) {
                    // put current property if not ignored property or property is ignored but isn't null (overwrite)
                    properties.put(propertyKey, propertyValue);
                }
            }
        }
        resultToUpdate.setPropertyMap(properties.isEmpty() ? null : properties);
        resultToUpdate.setResources(convertResourcesToServer(clientObject.getResources(), options));
        return resultToUpdate;
    }

}