protected override void ProcessRecord()
        {
            if (Force)
            {
                WriteObject(RemoveForce(Id, Connection));
            }
            else
            {
                var subnet = GetVirtualNet.GetbyvDCAll(Id, Connection);

                if (subnet.Any())
                {
                    throw new RemoteException("ou can not delete this virtual Datacenter as virtual Networks are related too.");
                }
                WriteObject(Remove(Id, Connection, Wait));
            }
        }
        public static CoreLibrary.Models.Job RemoveForce(Guid Id, Connection con)
        {
            CoreLibrary.Models.Job job;

            bool IsSuccessfull = true;


            var vnets = GetVirtualNet.GetbyvDCAll(Id, con);

            foreach (var vm in vnets)
            {
                job = RemoveVirtualNet.RemoveForce(vm.Id, con);
                if (job == null)
                {
                    IsSuccessfull = false;
                }
                else if (job.State == "failed")
                {
                    IsSuccessfull = false;
                }
            }

            var lbs = GetVirtualLoadBalancer.GetbyvDCAll(Id, con);

            foreach (var lb in lbs)
            {
                job = RemoveVirtualLoadBalancer.Remove(lb.Id, con, true);

                if (job == null)
                {
                    IsSuccessfull = false;
                }
                else if (job.State == "failed")
                {
                    IsSuccessfull = false;
                }
            }

            var gws = GetVirtualGateway.GetbyvDCAll(Id, con);

            foreach (var gw in gws)
            {
                job = RemoveVirtualGateway.Remove(gw.Id, con, true);

                if (job == null)
                {
                    IsSuccessfull = false;
                }
                else if (job.State == "failed")
                {
                    IsSuccessfull = false;
                }
            }

            var avs = GetAvailabilitySet.GetbyvDCAll(Id, con);

            foreach (var av in avs)
            {
                job = RemoveAvailabilitySet.Remove(av.Id, con, true);

                if (job == null)
                {
                    IsSuccessfull = false;
                }
                else if (job.State == "failed")
                {
                    IsSuccessfull = false;
                }
            }


            if (IsSuccessfull)
            {
                return(Remove(Id, con, true));
            }

            return(null);
        }