public async static Task StopContainer(StopContainerParameters parameters, IProducer <Null, string> p)
        {
            try {
                CancellationToken cancellation = new CancellationToken();
                await client.Containers.StopContainerAsync(parameters.ContainerId, new ContainerStopParameters { WaitBeforeKillSeconds = 5 }, cancellation);

                // Updating the containers with the new configurations right away and sending it out
                var updatedContainers = await DockerUpdater.FetchOverviewData();

                var overviewContainerUpdate = DockerUpdater.CreateOverViewData(updatedContainers);
                await KafkaHelpers.SendMessageAsync(DockerUpdater.OverviewTopic, overviewContainerUpdate, p);

                // Send response
                await KafkaHelpers.SendMessageAsync(_responseTopic, new ContainerResponse {
                    ResponseStatusCode = 200,
                    Message            = ResponseMessageContracts.CONTAINER_STOPPED,
                    ContainerIds       = new string[] { parameters.ContainerId }
                }, p);
            } catch (DockerApiException ex) {
                await KafkaHelpers.SendMessageAsync(_responseTopic, new ContainerResponse {
                    ResponseStatusCode = 400,
                    Message            = ex.Message,
                    ContainerIds       = new string[] { parameters.ContainerId }
                }, p);
            }
        }
        public async Task <bool> StopContainerAsync(string id, StopContainerParameters parameters, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentNullException("id");
            }

            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            string       path            = string.Format(CultureInfo.InvariantCulture, "containers/{0}/stop", id);
            IQueryString queryParameters = new QueryString <StopContainerParameters>(parameters);
            // since specified wait timespan can be greater than HttpClient's default, we set the
            // client timeout to infinite and provide a cancellation token.
            DockerApiResponse response = await this.Client.MakeRequestAsync(new[] { NoSuchContainerHandler }, HttpMethod.Post, path, queryParameters, null, new TimeSpan(Timeout.Infinite), cancellationToken).ConfigureAwait(false);

            return(response.StatusCode != HttpStatusCode.NotModified);
        }