private static void SaveHomepageImages(Homepage homepage, IEnumerable <BinaryFile> imageList)
        {
            var count = 0;
            var size  = new Size(168, 124);

            foreach (BinaryFile image in imageList)
            {
                count++;
                HomepageImageManager.SaveHomepageImage(homepage, count, image, size);
            }
        }
        /// <summary>
        /// Creates an unpublished copy of the homepage and returns it
        /// </summary>
        /// <param name="homepage">The homepage to be copied</param>
        /// <returns>Copy of homepage</returns>
        public static Homepage GetCopy(Homepage homepage)
        {
            // List of images
            IList <BinaryFile> imageList = new List <BinaryFile>();

            // Get the ID of the homepage being copied
            int homepageId = homepage.HomepageId.GetValueOrDefault();

            // Set the homepage ID to null so we create a new record on save
            homepage.HomepageId = null;

            // The copied homepage is not published
            homepage.IsPublished = false;

            // Save the homepage
            Homepage.Update(homepage);

            // Get all of the images
            for (int i = 1; i <= 4; i++)
            {
                BinaryFile file = BinaryFile.Empty;

                string imagePath = HomepageImageManager.GetHomepageImagePath(homepageId, i);

                if (!StringUtils.IsBlank(imagePath) && File.Exists(imagePath))
                {
                    file = new BinaryFile(imagePath, BinaryFile.SaveMode.Copy);
                }

                imageList.Add(file);
            }

            // Save the homepage images
            SaveHomepageImages(homepage, imageList);

            // Return the copy
            return(homepage);
        }