func GetSiteByName(name string) (models.Site, error) {
	var site models.Site
	err := DB.C(sitesCollection).Find(bson.M{
		"name": name,
	}).One(&site)
	return site, err
}
GetSiteByName : return specific site
package database
import (
	"time"
	"github.com/backpulse/core/constants"
	"github.com/backpulse/core/models"
	"github.com/backpulse/core/utils"
	"gopkg.in/mgo.v2/bson"
)
func GetSiteTotalSize(siteID bson.ObjectId) float64 {
	photos, _ := GetSitePhotos(siteID)
	var totalSize float64
	for _, photo := range photos {
		totalSize = totalSize + photo.Size
	}
	files, _ := GetSiteFiles(siteID)
	for _, file := range files {
		totalSize = totalSize + file.Size
	}
	return totalSize
}
func TransferSite(site models.Site, lastOwner models.User, newOwner models.User) error {
	collections := []string{contactCollection, aboutCollection, galleriesCollection, projectsCollection, photosCollection}
	for _, c := range collections {
		DB.C(c).Update(bson.M{
			"site_id": site.ID,
		}, bson.M{
			"$set": bson.M{
				"owner_id": newOwner.ID,
			},
		})
	}
	err := DB.C(sitesCollection).UpdateId(site.ID, bson.M{
		"$set": bson.M{
			"owner_id": newOwner.ID,
		},
	})
	RemoveCollaborator(site.ID, newOwner.Email)
	AddCollaborator(site.ID, models.Collaborator{
		Email: lastOwner.Email,
		Role:  "collaborator",
	})
	return err
}
func GetSitesOfUser(user models.User) ([]models.Site, error) {
	var sites []models.Site
	err := DB.C(sitesCollection).Find(bson.M{
		"$or": []bson.M{
			{
				"owner_id": user.ID,
			},
			{
				"collaborators": models.Collaborator{
					Email: user.Email,
					Role:  "collaborator",
				},
			},
		},
	}).All(&sites)
	for i := range sites {
		for _, id := range user.FavoriteSites {
			if sites[i].ID == id {
				sites[i].Favorite = true
			}
		}
		for _, collaborator := range sites[i].Collaborators {
			if collaborator.Email == user.Email {
				sites[i].Role = "collaborator"
			}
		}
		if sites[i].Role == "" {
			sites[i].Role = "owner"
		}
	}
	return sites, err
}
func GetOwnedSites(id bson.ObjectId) ([]models.Site, error) {
	var sites []models.Site
	err := DB.C(sitesCollection).Find(bson.M{
		"owner_id": id,
	}).All(&sites)
	return sites, err
}
func AddCollaborator(id bson.ObjectId, collaborator models.Collaborator) error {
	err := DB.C(sitesCollection).UpdateId(id, bson.M{
		"$push": bson.M{
			"collaborators": collaborator,
		},
	})
	return err
}
func RemoveCollaborator(id bson.ObjectId, email string) error {
	err := DB.C(sitesCollection).UpdateId(id, bson.M{
		"$pull": bson.M{
			"collaborators": bson.M{
				"role":  "collaborator",
				"email": email,
			}},
	})
	return err
}