class BusinessObjectDataServiceImpl implements BusinessObjectDataService {

    @NamespacePermission(fields = "#businessObjectDataKey.namespace", permissions = {NamespacePermissionEnum.WRITE, NamespacePermissionEnum.WRITE_ATTRIBUTE})
    @Override
    public BusinessObjectData updateBusinessObjectDataAttributes(BusinessObjectDataKey businessObjectDataKey,
        BusinessObjectDataAttributesUpdateRequest businessObjectDataAttributesUpdateRequest)
    {
        // Validate and trim the business object data key.
        businessObjectDataHelper.validateBusinessObjectDataKey(businessObjectDataKey, true, true);

        // Validate the update request.
        Assert.notNull(businessObjectDataAttributesUpdateRequest, "A business object data attributes update request must be specified.");
        Assert.notNull(businessObjectDataAttributesUpdateRequest.getAttributes(), "A list of business object data attributes must be specified.");
        List<Attribute> attributes = businessObjectDataAttributesUpdateRequest.getAttributes();

        // Validate attributes. This is also going to trim the attribute names.
        attributeHelper.validateAttributes(attributes);

        // Retrieve the business object data and ensure it exists.
        BusinessObjectDataEntity businessObjectDataEntity = businessObjectDataDaoHelper.getBusinessObjectDataEntity(businessObjectDataKey);

        // Validate attributes against attribute definitions.
        attributeDaoHelper.validateAttributesAgainstBusinessObjectDataAttributeDefinitions(attributes,
            businessObjectDataEntity.getBusinessObjectFormat().getAttributeDefinitions());

        // Update the attributes.
        attributeDaoHelper.updateBusinessObjectDataAttributes(businessObjectDataEntity, attributes);

        // Persist and refresh the entity.
        businessObjectDataEntity = businessObjectDataDao.saveAndRefresh(businessObjectDataEntity);

        // Create and return the business object data object from the persisted entity.
        return businessObjectDataHelper.createBusinessObjectDataFromEntity(businessObjectDataEntity);
    }

}