func UpdatePage(db *gorm.DB, id int, title string, slug string, tags []Tag, template string, content string, siteID int) bool {
	pageData := FetchPage(db, id)
	db.Model(&pageData).Association("Tags").Clear()
	pageData.Title = title
	pageData.Slug = slug
	pageData.Content = content
	pageData.Template = template
	pageData.SiteID = siteID
	pageData.Tags = tags
	if err := db.Save(&pageData).Error; err != nil {
		fmt.Println("Could not create site")
		return false
	}
	return true
}
UpdatePage is a method which updates a page in the database with relevant data
package structs
import (
	"fmt"
	"github.com/uberswe/beubo/pkg/structs/page"
	"gorm.io/gorm"
	"html/template"
)
type Page struct {
	gorm.Model
	Title       string `gorm:"size:255"`
	Content     string `sql:"type:text"`
	Description string `sql:"type:text"`
	Excerpt     string `sql:"type:text"`
	Slug        string `gorm:"size:255;unique_index:idx_slug_site_id"`
	Template    string `gorm:"size:255"`
	Site        Site
	SiteID      int   `gorm:"unique_index:idx_slug_site_id"`
	Tags        []Tag `gorm:"many2many:page_tags;"`
}
type PageData struct {
	Theme       string
	Template    string
	Templates   map[string]string
	Themes      map[string]string
	Title       string
	WebsiteName string
	URL         string
	Error       string
	Warning     string
	Message     string
	Year        string
	Stylesheets []string
	Scripts     []string
	Favicon     string
	Extra       interface{}
	Components  []page.Component
	Menus       []page.Menu
}
type Tag struct {
	gorm.Model
	Value string `gorm:"unique;not null"`
}
type JSONTag struct {
	Value string `json:"value"`
}
type Comment struct {
	gorm.Model
	User    User
	UserID  int
	Email   string
	Website string
	Text    string
	Page    Page
	PageID  int
}
func CreatePage(db *gorm.DB, title string, slug string, tags []Tag, template string, content string, siteID int) bool {
	pageData := Page{
		Title:    title,
		Content:  content,
		Slug:     slug,
		Template: template,
		SiteID:   siteID,
		Tags:     tags,
	}
	if err := db.Create(&pageData).Error; err != nil {
		fmt.Println("Could not create pageData")
		return false
	}
	return true
}
func FetchPage(db *gorm.DB, id int) Page {
	pageData := Page{}
	db.Preload("Tags").First(&pageData, id)
	return pageData
}
func FetchPageBySiteIDAndSlug(db *gorm.DB, SiteID int, slug string) Page {
	pageData := Page{}
	db.Where("slug = ? AND site_id = ?", slug, SiteID).First(&pageData)
	return pageData
}