String bindingKey = binding.getBindingKey();
// Confirm that the 'BusinessService' that this binding belongs to
// really exists. If not then throw an InvalidKeyPassedException.
if ((serviceKey == null) || (serviceKey.length() == 0) || (!dataStore.isValidServiceKey(serviceKey)))
throw new InvalidKeyPassedException("ServiceKey: "+serviceKey);
// Confirm that 'publisherID' controls the BusinessService that this
// binding template belongs to. If not then throw a UserMismatchException.
if (!dataStore.isServicePublisher(serviceKey,publisherID))
throw new UserMismatchException("ServiceKey: "+serviceKey);
// If a BindingKey was specified then make sure it's a valid one.
if ((bindingKey != null) && (bindingKey.length() > 0) && (!dataStore.isValidBindingKey(bindingKey)))
throw new InvalidKeyPassedException("BindingKey: "+bindingKey);
// Normally, a valid tModelKey MUST be specified for the keyedReference
// to be valid. However, in the case of a keyedReference that is used in
// a categoryBag, the tModelKey may be omitted or specified as a
// zero-length string to indicate that the taxonomy being used is