// *** End programmer edit section *** (MessageBS CustomMembers)


        // *** Start programmer edit section *** (OnUpdateMessage CustomAttributes)

        // *** End programmer edit section *** (OnUpdateMessage CustomAttributes)
        public virtual ICSSoft.STORMNET.DataObject[] OnUpdateMessage(NewPlatform.Flexberry.ServiceBus.Message UpdatedObject)
        {
            // *** Start programmer edit section *** (OnUpdateMessage)
            if (UpdatedObject.GetStatus() == ObjectStatus.Created && !string.IsNullOrEmpty(UpdatedObject.Group) &&
                DataService.GetObjectsCount(GetMessagesWithGroupLCS(UpdatedObject.Recipient, UpdatedObject.MessageType, UpdatedObject.Group)) > 0)
            {
                throw new Exception($"A similar message with the group '{UpdatedObject.Group}' already exists.");
            }

            return(new ICSSoft.STORMNET.DataObject[0]);
            // *** End programmer edit section *** (OnUpdateMessage)
        }
        /// <inheritdoc/>
        public override bool SendMessage(Message message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            if (string.IsNullOrEmpty(Client.Address))
            {
                Logger.LogError("Error sending message to client via WEB.", $"The client '{Client.Name ?? Client.ID}' not specified address to send messages.", message);
                return(false);
            }

            ChannelFactory <ICallbackSubscriber> channelFactory;
            ICallbackSubscriber channel;

            try
            {
                var endpointAddress = new EndpointAddress(new Uri(Client.Address), AddressHeader.CreateAddressHeader("headerName", Regex.Replace(Client.Address, ".asmx$", string.Empty), "headerValue"));
                channelFactory = new ChannelFactory <ICallbackSubscriber>(new BasicHttpBinding(), endpointAddress);
                channel        = channelFactory.CreateChannel();
                ((IClientChannel)channel).Open();
            }
            catch (Exception exception)
            {
                Logger.LogUnhandledException(exception, message);
                throw exception;
            }

            var sbMessage = new MessageFromESB()
            {
                MessageFormingTime = message.ReceivingTime,
                MessageTypeID      = message.MessageType.ID,
                Body       = message.Body,
                Attachment = message.BinaryAttachment,
                SenderName = message.Sender,
                GroupID    = message.Group,
                Tags       = ServiceHelper.GetTagDictionary(message),
            };

            return(ServiceHelper.TryWithExceptionLogging(
                       () => channel.AcceptMessage(sbMessage),
                       () =>
            {
                ((IClientChannel)channel).Close();
                channelFactory.Close();
            },
                       $"Error sending message to the client '{Client.Name ?? Client.ID}' via WEB at address '{Client.Address}'.",
                       Client,
                       message,
                       Logger));
        }