/// <summary>
        /// Remove an entity tree link between to entities.
        /// </summary>
        /// <param name="record"></param>
        /// <returns></returns>
        public override FluidTrade.Core.ErrorCode Delete(EntityTree record)
        {
            DataModel            dataModel     = new DataModel();
            DataModelTransaction transaction   = DataModelTransaction.Current;
            EntityTreeRow        entityTreeRow = DataModel.EntityTree.EntityTreeKey.Find(record.RowId);
            Guid parentEntityId;

            if (entityTreeRow == null)
            {
                return(ErrorCode.RecordNotFound);
            }

            entityTreeRow.AcquireWriterLock(transaction);
            parentEntityId = entityTreeRow.ParentId;

            if (!DataModelFilters.HasAccess(transaction, TradingSupport.UserId, parentEntityId, AccessRight.Write))
            {
                return(ErrorCode.AccessDenied);
            }

            dataModel.DestroyEntityTree(new object[] { record.RowId }, record.RowVersion);

            return(ErrorCode.Success);
        }