private void FindWebPart()
        {
            using (SPLimitedWebPartManager wpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared))
            {
                foreach (System.Web.UI.WebControls.WebParts.WebPart wpm_webpart in wpm.WebParts)
                {
                    if (this.Page.Request.QueryString[WEBPARTIDQSKEYNAME] == wpm_webpart.ID)
                    {
                        webpart = wpm_webpart as WebSitePart;
                        break;
                    }
                }

            }
        }
        private bool ApplyChanges()
        {
            using (SPLimitedWebPartManager wpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared))
            {

                foreach (System.Web.UI.WebControls.WebParts.WebPart wpm_webpart in wpm.WebParts)
                {
                    if (this.Page.Request.QueryString[WEBPARTIDQSKEYNAME] == wpm_webpart.ID)
                    {
                        webpart = wpm_webpart as WebSitePart;
                        break;
                    }
                }

                if (webpart != null)
                {
                    wpm.Web.AllowUnsafeUpdates = true;


                    PropertyInfo[] properties = webpart.GetType().GetProperties();

                    foreach (PropertyInfo propertyInfo in properties)
                    {

                        Type propertyType = propertyInfo.PropertyType;
                        IDisplayableClass displayClass = WebPartServiceLocator.Current.DisplayableClasses.FirstOrDefault(c => c.IsAppliable(propertyType));
                        Control control = FindControlRecursive(section,"control_" + propertyInfo.Name.ToString());
                        if (control != null)
                        {
                            propertyInfo.SetValue(webpart, displayClass.GetControlValue(control), null);
                        }
                    }

                    wpm.SaveChanges(webpart);
                    wpm.Web.AllowUnsafeUpdates = false;

                    foreach (Microsoft.SharePoint.WebPartPages.WebPart wp in wpm.WebParts)
                    {
                        wpm.SaveChanges(wp);
                    }
                }
            }
            return true;
        }