class StorageUnitDaoHelper {

    public StorageUnitEntity getStorageUnitEntity(String storageName, BusinessObjectDataEntity businessObjectDataEntity)
    {
        StorageUnitEntity storageUnitEntity = null;

        StorageEntity storageEntity = storageDao.getStorageByName(storageName);

        // If the storage entity does exist get the storage unit entity.
        if (storageEntity != null)
        {
            storageUnitEntity = storageUnitDao.getStorageUnitByBusinessObjectDataAndStorage(businessObjectDataEntity, storageEntity);
        }

        // If the storage unit entity was not found return object not found exception.
        if (storageUnitEntity == null)
        {
            throw new ObjectNotFoundException(String.format("Could not find storage unit in \"%s\" storage for the business object data {%s}.", storageName,
                businessObjectDataHelper.businessObjectDataEntityAltKeyToString(businessObjectDataEntity)));
        }

        return storageUnitEntity;
    }

}