public virtual void Delete(Collectioncreation entity)
 {
     this.Service.Delete(entity);
 }
        protected void ButtonClick(object sender, EventArgs e)
        {
            this.HideLabels();
            var Collectionname = txtCollectionname.Text.Trim();
            var Sessionhost = txtSessionhost.Text.Trim();
            var Collectiondescription = txtCollectiondescription.Text.Trim();
            var Connectionbroker = txtConnectionbroker.Text.Trim();

            // Switch Name validation
            if (string.IsNullOrWhiteSpace(Collectionname))
            {
                this.ShowErrorMessage("Please enter collection name.");
                return;
            }

            if (string.IsNullOrWhiteSpace(Sessionhost))
            {
                this.ShowErrorMessage("Please enter Session host server name.");
                return;
            }

            if (string.IsNullOrWhiteSpace(Collectiondescription))
            {
                this.ShowErrorMessage("Please enter collection Description.");
                return;
            }

            if (string.IsNullOrWhiteSpace(Connectionbroker))
            {
                this.ShowErrorMessage("Please enter Connection Broker server name.");
                return;
            }

            try
            {
                //Call PSI file creater Method:
                CreatePSIFile(Collectionname, Sessionhost, Collectiondescription, Connectionbroker);

                if (0 == EditCollectionCreationId)
                {
                    var clientUser = new Collectioncreation()
                    {
                        CreatedBy = Context.User.Identity.Name,
                        CreatedDate = DateTimeHelper.Now,
                        Collectionname =Collectionname,
                        Sessionhost = Sessionhost,
                        Collectiondescription = Collectiondescription,
                        Connectionbroker = Connectionbroker
                    };

                    Collectioncreationservice.Create(clientUser);
                    ShowSuccessMessage("Script Generated. Click to download.");
                    txtCollectiondescription.Text = string.Empty;
                    txtCollectionname.Text = string.Empty;
                    txtConnectionbroker.Text = string.Empty;
                    txtSessionhost.Text = string.Empty;
                }
                else
                {
                    var collectioncreation = Collectioncreationservice.Retrieve(EditCollectionCreationId);
                    collectioncreation.Collectionname = Collectionname;
                    collectioncreation.Sessionhost = Sessionhost;
                    collectioncreation.Collectiondescription = Collectiondescription;
                    collectioncreation.Connectionbroker = Connectionbroker;

                    Collectioncreationservice.Update(collectioncreation);
                    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);
            }
        }