public async Task NotifyObserversAsync(GatewayRequest request)
        {
            try
            {
                // Validates parameter
                if (string.IsNullOrWhiteSpace(request?.Topic) ||
                    (request.Messages == null) ||
                    !request.Messages.Any() ||
                    (request.ObservableEntityId?.ServiceUri == null) ||
                    (request.ObservableEntityId.ActorId == null))
                {
                    throw new ArgumentException($"Parameter {nameof(request)} is null or invalid.", nameof(request));
                }

                // Gets actor proxy
                IClientObservableActor proxy = GetActorProxy(
                    new ActorId(request.ObservableEntityId.ActorId),
                    request.ObservableEntityId.ServiceUri);
                if (proxy == null)
                {
                    throw new ApplicationException("The ActorProxy cannot be null.");
                }

                // Invokes actor using proxy
                foreach (Message message in request.Messages.Where(message => message != null))
                {
                    ServiceEventSource.Current.Message(
                        $"Notifying observers...\r\n[Observable]: {request.ObservableEntityId}\r\n[Message]: Topic=[{request.Topic}] Body=[{message.Body ?? "NULL"}]");
                    await proxy.NotifyObserversAsync(request.Topic, message, request.UseObserverAsProxy);
                }
            }
            catch (AggregateException ex)
            {
                if (!(ex.InnerExceptions?.Count > 0))
                {
                    throw new HttpResponseException(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
                }
                foreach (Exception exception in ex.InnerExceptions)
                {
                    ServiceEventSource.Current.Message(exception.Message);
                }
                throw new HttpResponseException(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
            }
            catch (Exception ex)
            {
                ServiceEventSource.Current.Message(ex.Message);
                throw new HttpResponseException(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
            }
        }
        public async Task ClearObserversAndPublicationsAsync(GatewayRequest request)
        {
            try
            {
                // Validates parameter
                if ((request.ObservableEntityId?.ServiceUri == null) ||
                    (request.ObservableEntityId.ActorId == null))
                {
                    throw new ArgumentException($"Parameter {nameof(request)} is null or invalid.", nameof(request));
                }

                // Gets actor proxy
                IClientObservableActor proxy = GetActorProxy(
                    new ActorId(request.ObservableEntityId.ActorId),
                    request.ObservableEntityId.ServiceUri);
                if (proxy == null)
                {
                    throw new ApplicationException("The ActorProxy cannot be null.");
                }

                // Invokes actor using proxy
                ServiceEventSource.Current.Message($"Clearing observers and publications...\r\n[Observable]: {request.ObservableEntityId}");
                await proxy.ClearObserversAndPublicationsAsync(request.UseObserverAsProxy);
            }
            catch (AggregateException ex)
            {
                if (!(ex.InnerExceptions?.Count > 0))
                {
                    throw new HttpResponseException(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
                }
                foreach (Exception exception in ex.InnerExceptions)
                {
                    ServiceEventSource.Current.Message(exception.Message);
                }
                throw new HttpResponseException(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
            }
            catch (Exception ex)
            {
                ServiceEventSource.Current.Message(ex.Message);
                throw new HttpResponseException(this.Request.CreateErrorResponse(HttpStatusCode.NotFound, ex.Message));
            }
        }
        public async Task RegisterObservableActorAsync(GatewayRequest request)
        {
            try
            {
                // Validates parameter
                if (string.IsNullOrWhiteSpace(request?.Topic) ||
                    request.ObservableEntityId?.ServiceUri == null ||
                    request.ObservableEntityId.ActorId == null)
                {
                    throw new ArgumentException($"Parameter {nameof(request)} is null or invalid.", nameof(request));
                }

                // Gets actor proxy
                IClientObservableActor proxy = GetActorProxy(new ActorId(request.ObservableEntityId.ActorId),
                                                             request.ObservableEntityId.ServiceUri);
                if (proxy == null)
                {
                    throw new ApplicationException("The ActorProxy cannot be null.");
                }

                // Invokes actor using proxy
                ServiceEventSource.Current.Message($"Registering observable...\r\n[Observable]: {request.ObservableEntityId}\r\n[Publication]: Topic=[{request.Topic}]");
                await proxy.RegisterObservableActorAsync(request.Topic);
            }
            catch (AggregateException ex)
            {
                if (!(ex.InnerExceptions?.Count > 0))
                {
                    throw;
                }
                foreach (Exception exception in ex.InnerExceptions)
                {
                    ServiceEventSource.Current.Message(exception.Message);
                }
                throw;
            }
            catch (Exception ex)
            {
                ServiceEventSource.Current.Message(ex.Message);
                throw;
            }
        }