private static void CheckEntityIsNotTracked(DataServiceContextData data, object entity)
        {
            ExceptionUtilities.CheckArgumentNotNull(data, "data");

            EntityDescriptorData descriptorData;
            if (data.TryGetEntityDescriptorData(entity, out descriptorData))
            {
                throw new TaupoInvalidOperationException(
                    string.Format(CultureInfo.InvariantCulture, "Specified entity is already tracked by the descriptor data: {0}.", descriptorData.ToString()));
            }
        }
        private static void CheckIdentity(DataServiceContextData data, Uri identity)
        {
            ExceptionUtilities.CheckArgumentNotNull(data, "data");

            if (identity == null)
            {
                throw new TaupoInvalidOperationException("Entity identity cannot be null or empty.");
            }

            EntityDescriptorData descriptorData;
            if (data.TryGetEntityDescriptorData(identity, out descriptorData))
            {
                throw new TaupoInvalidOperationException(
                    string.Format(CultureInfo.InvariantCulture, "There is already an entity descriptor data with the specified identity: {0}.", descriptorData.ToString()));
            }
        }
        private static EntityDescriptorData GetTrackedEntityDescriptorData(DataServiceContextData data, object entity, string errorMessage, string argumentName)
        {
            ExceptionUtilities.CheckArgumentNotNull(data, "data");

            EntityDescriptorData descriptorData;
            if (!data.TryGetEntityDescriptorData(entity, out descriptorData))
            {
                throw new TaupoInvalidOperationException(errorMessage + " " + argumentName + " is not tracked by the data service context data.");
            }

            return descriptorData;
        }