private void UnSubscribeFromApplicationGrid()
 {
     try
     {
         ApUnSubscribeNodeRequest request = new ApUnSubscribeNodeRequest(Settings.Credentials);
         request.IpAddress = Database.Node.IpAddress;
         EndPoints.GetApNodeControllerService().UnSubscribeNode(request);
     }
     catch (Exception e)
     {
         Log.Error(this, e);
     }
 }
        private void SubscribeToApplicationGrid()
        {
            try
            {
                Console.WriteLine("Subscribing to Application Grid at: " + Settings.ApplicationGridEndPointURL);

                MonoscapeCredentials   credentials = new MonoscapeCredentials(Settings.MonoscapeAccessKey, Settings.MonoscapeSecretKey);
                ApSubscribeNodeRequest request     = new ApSubscribeNodeRequest(credentials);
                IPAddress hostIp = MonoscapeUtil.FindHostIpAddress();
                request.IpAddress  = hostIp.ToString();
                request.IpAddress_ = hostIp;
                request.ApplicationGridServiceUrl = Settings.ApplicationGridServiceUrl;
                request.FileTransferServiceUrl    = Settings.FileServerServiceUrl + "/wsHttp";
                IApNodeControllerService channel  = EndPoints.GetApNodeControllerService();
                ApSubscribeNodeResponse  response = channel.SubscribeNode(request);
                Database.Node = response.Node;

                Console.WriteLine("Subscribed successfully");
            }
            catch (EndpointNotFoundException e)
            {
                throw new MonoscapeException("Could not connect to the Application Grid", e);
            }
        }