def save(location)
      if fragments.length == 1
        FileUtils.mv(fragments.first.path, location)
      else
        remove_saved_files(location)
        root = File.join(Pathname.new(location).dirname, "sitemaps")
        Dir.mkdir(root) unless File.directory?(root)
        fragments.each_with_index do |fragment, i|
          file_pattern = File.join(root, "sitemap-fragment-#{i + 1}.xml")
          FileUtils.mv(fragment.path, file_pattern)
          File.chmod(0755, file_pattern)
        end
        file = File.new(location, "w")
        file.write(render "index")
        file.close
      end
      File.chmod(0755, location)
    end
def save(location)
      if fragments.length == 1
        FileUtils.mv(fragments.first.path, location)
      else
        remove_saved_files(location)
        root = File.join(Pathname.new(location).dirname, "sitemaps")
        Dir.mkdir(root) unless File.directory?(root)
        fragments.each_with_index do |fragment, i|
          file_pattern = File.join(root, "sitemap-fragment-#{i + 1}.xml")
          FileUtils.mv(fragment.path, file_pattern)
          File.chmod(0755, file_pattern)
        end
        file = File.new(location, "w")
        file.write(render "index")
        file.close
      end
      File.chmod(0755, location)
    end
Creates the sitemap index file and saves any existing fragments.