protected void PublishButton_Click(object sender, EventArgs e) { // Get the homepage being edited Homepage homepage = Homepage.Get(HomepageId); // If the homepage being edited is not for the brand being edited // then create a copy of it, which will become the brand homepage. if (homepage.BrandId != EditingBrandId) { homepage = HomepageManager.GetCopy(homepage); } // List of images IList <BinaryFile> imageList = new List <BinaryFile>(); // Get the homepage and images GetHomepageAndImages(ref homepage, ref imageList); try { HomepageManager.PublishHomepage(CurrentUser, homepage, imageList); MessageLabel1.SetSuccessMessage("Homepage published successfully"); DisplayHomepage(homepage); } catch (InvalidHomepageException ihex) { MessageLabel1.SetErrorMessage("the following errors occured:", ihex.Errors); } }