class AttributeDaoHelper {

    public void validateAttributesAgainstBusinessObjectDataAttributeDefinitions(final List<Attribute> attributes,
        final Collection<BusinessObjectDataAttributeDefinitionEntity> businessObjectDataAttributeDefinitionEntities)
    {
        // Build a map of the specified attributes in the request where the key is lower case for case insensitive checks.
        Map<String, String> attributeMap = new HashMap<>();
        if (!CollectionUtils.isEmpty(attributes))
        {
            for (Attribute attribute : attributes)
            {
                attributeMap.put(attribute.getName().toLowerCase(), attribute.getValue());
            }
        }

        // Loop through each attribute definition (i.e. the required attributes) and verify that each attribute
        // definition was specified in the list of attributes and that the specified value has non-blank data.
        for (BusinessObjectDataAttributeDefinitionEntity attributeDefinitionEntity : businessObjectDataAttributeDefinitionEntities)
        {
            String attributeDefinitionName = attributeDefinitionEntity.getName().toLowerCase();
            if (!attributeMap.containsKey(attributeDefinitionName) || StringUtils.isBlank(attributeMap.get(attributeDefinitionName)))
            {
                throw new IllegalArgumentException(String
                    .format("The business object format has a required attribute \"%s\" which was not specified or has a value which is blank.",
                        attributeDefinitionEntity.getName()));
            }
        }
    }

}