protected void ButtonClick(object sender, EventArgs e)
        {
            this.HideLabels();
            var Vmname = txtVmname.Text.Trim();
            var Vmpath = txtVmpath.Text.Trim();
            var Physicaladapter = txtPhysicaladapter.Text.Trim();
            var SwitchName = txtSwitchName.Text.Trim();
            var Maxmem = txtMaxmem.Text.Trim();
            var Minmem = txtMinmem.Text.Trim();
            var Isopath = txtIsopath.Text.Trim();
            var Hddsize = Txthddsize.Text.Trim();

            // VM Parameters validation
            if (string.IsNullOrWhiteSpace(Vmname))
            {
                this.ShowErrorMessage("Please enter Virtual Machine name.");
                return;
            }

            if (string.IsNullOrWhiteSpace(Vmpath))
            {
                this.ShowErrorMessage("Please enter VM Path.");
                return;
            }
            if (string.IsNullOrWhiteSpace(Physicaladapter))
            {
                this.ShowErrorMessage("Please enter Physical switch adapter name.");
                return;
            }

            if (string.IsNullOrWhiteSpace(SwitchName))
            {
                this.ShowErrorMessage("Please enter Switch name.");
                return;
            }
            if (string.IsNullOrWhiteSpace(Maxmem))
            {
                this.ShowErrorMessage("Please enter Maximum memory for VM.");
                return;
            }

            if (string.IsNullOrWhiteSpace(Minmem))
            {
                this.ShowErrorMessage("Please enter Minimum memory for VM.");
                return;
            }

            if (string.IsNullOrWhiteSpace(Hddsize))
            {
                this.ShowErrorMessage("Please enter Disk Size.");
                return;
            }
            if (string.IsNullOrWhiteSpace(Isopath))
            {
                this.ShowErrorMessage("Please enter the location of OS ISO.");
                return;
            }

            try
            {
                //Call PSI file creater Method:
                CreatePSIFile(Vmname, Vmpath, Physicaladapter, SwitchName, Maxmem, Minmem, Hddsize, Isopath);

                if (0 == EditVMCreationId)
                {
                    var clientUser = new VMCreation()
                    {
                        CreatedBy = Context.User.Identity.Name,
                        CreatedDate = DateTimeHelper.Now,
                        Vmname=Vmname,
                        Vmpath=Vmpath,
                        Physicaladapter=Physicaladapter,
                        SwitchName=SwitchName,
                        Maxmem=Maxmem,
                        Minmem=Minmem,
                        Hddsize=Hddsize,
                        Isopath=Isopath
                    };

                    VMcreationService.Create(clientUser);
                    ShowSuccessMessage("Script Generated. Click to download.");
                    txtVmname.Text = string.Empty;
                    txtVmpath.Text = string.Empty;
                    txtPhysicaladapter.Text = string.Empty;
                    txtSwitchName.Text = string.Empty;
                    txtMaxmem.Text = string.Empty;
                    txtMinmem.Text = string.Empty;
                    txtIsopath.Text = string.Empty;
                    Txthddsize.Text = string.Empty;
                }
                else
                {
                    var virtualMachineCreation = VMcreationService.Retrieve(EditVMCreationId);
                    virtualMachineCreation.Vmname = Vmname;
                    virtualMachineCreation.Vmpath = Vmpath;
                    virtualMachineCreation.Physicaladapter = Physicaladapter;
                    virtualMachineCreation.SwitchName = SwitchName;
                    virtualMachineCreation.Maxmem = Maxmem;
                    virtualMachineCreation.Minmem = Minmem;
                    virtualMachineCreation.Isopath = Isopath;
                    virtualMachineCreation.Hddsize = Hddsize;

                    VMcreationService.Update(virtualMachineCreation);
                    ShowSuccessMessage("Script Generated. Click to download.");
                }
            }
            catch (Exception ex)
            {
                this.ShowErrorMessage(
                    ex.Message.Contains(
                        "An error occurred while updating the entries. See the inner exception for details.")
                        ? "Duplicate Entry"
                        : ex.Message);
            }
        }
 public virtual void Delete(VMCreation entity)
 {
     this.Service.Delete(entity);
 }