private void StopRunningService()
        {
            try
            {
                var status = _processManager.GetProcessStatus("dotnet");
                if (status != ProcessStatus.Running)
                {
                    return;
                }
            }
            catch (ArgumentNullException)
            {
                // This means the process is not managed by this app
                return;
            }

            var dotnetProcess = _processManager.Processes.First(p => p.Name == "dotnet");

            _processManager.KillProcess(dotnetProcess);

            var maxWait     = 10000;
            var currentWait = 0;

            while (_processManager.GetProcessStatus("dotnet") == ProcessStatus.Running)
            {
                if (currentWait >= maxWait)
                {
                    throw new TimeoutException("Stopping dotnet failed");
                }

                Thread.Sleep(50);
                currentWait = 50;
            }
        }