protected void ButtonClick(object sender, EventArgs e)
        {
            this.HideLabels();
            bool returnResult = false;
            var Alias = txtAlias.Text.Trim();
            var Displayname = txtDisplayname.Text.Trim();
            var Filepath = txtFilepath.Text.Trim();
            var collectionname = txtcollectionname.Text.Trim();
            var connectionbroker = txtConnectionbroker.Text.Trim();

            // App publish parameters validation
            if (string.IsNullOrWhiteSpace(Alias))
            {
                this.ShowErrorMessage("Please enter Alias name.");
                return;
            }

            if (string.IsNullOrWhiteSpace(Displayname))
            {
                this.ShowErrorMessage("Please enter Display Name.");
                return;
            }

            if (string.IsNullOrWhiteSpace(Filepath))
            {
                this.ShowErrorMessage("Please enter File Path.");
                return;
            }

            if (string.IsNullOrWhiteSpace(collectionname))
            {
                this.ShowErrorMessage("Please enter Collection Name.");
                return;
            }

            if (string.IsNullOrWhiteSpace(connectionbroker))
            {
                this.ShowErrorMessage("Please enter Collection Broker name.");
                return;
            }
            try
            {
                //Call PSI file creater Method:
                CreatePSIFile(Alias, Displayname, Filepath, collectionname, connectionbroker);

                if (0 == EditApppublishId)
                {
                    var clientUser = new Apppublish()
                    {
                        CreatedBy = Context.User.Identity.Name,
                        CreatedDate = DateTimeHelper.Now,
                        Alias = Alias,
                        Displayname=Displayname,
                        Filepath=Filepath,
                        collectionname=collectionname,
                        Connectionbroker=connectionbroker
                    };

                    ApppublishService.Create(clientUser);
                    ShowSuccessMessage("Script Generated. Click to download.");

                    txtAlias.Text = string.Empty;
                    txtDisplayname.Text = string.Empty;
                    txtFilepath.Text = string.Empty;
                    txtcollectionname.Text = string.Empty;
                    txtConnectionbroker.Text = string.Empty;
                }
                else
                {
                    var Apppublish = ApppublishService.Retrieve(EditApppublishId);
                    Apppublish.Alias = Alias;
                    Apppublish.Displayname = Displayname;
                    Apppublish.Filepath = Filepath;
                    Apppublish.collectionname = collectionname;
                    Apppublish.Connectionbroker = connectionbroker;

                    ApppublishService.Update(Apppublish);
                    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(Apppublish entity)
 {
     this.Service.Delete(entity);
 }