/// <summary>
 /// Stops the job.
 /// </summary>
 public void Stop()
 {
     StopCore();
     lock (syncRoot)
     {
         ListeningJob = null;
     }
 }
        /// <summary>
        /// Starts execution of the job.
        /// </summary>
        /// <returns>void; it is an <i>async</i> method.</returns>
        /// <exception cref="PlatformserviceApplicationException">If some other job is already listening for incoming invitations.</exception>
        public override Task ExecuteCoreAsync()
        {
            lock (syncRoot)
            {
                if (ListeningJob != null)
                {
                    throw new PlatformserviceApplicationException("A job with ID " + ListeningJob.JobId + " is already listening, please stop it before starting a new one.");
                }
                ListeningJob = this;
            }

            StartCore();

            return(Task.CompletedTask);
        }