You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: controller.go
    path of file: ./repos/ente/server/pkg/controller/commonbilling
    
    the code of the file until where you have to start completion: package commonbilling

import (
	"context"
	"fmt"
	"github.com/ente-io/museum/pkg/repo"
	"github
    
func (c *Controller) CanDowngradeToGivenStorage(newStorage int64, userID int64) (bool, error) {
	adminID, err := c.UserRepo.GetFamilyAdminID(userID)
	if err != nil {
		return false, stacktrace.Propagate(err, "")
	}

	if adminID == nil {
		bonusStorage, bonErr := c.StorageBonusRepo.GetPaidAddonSurplusStorage(context.Background(), userID)
		if bonErr != nil {
			return false, stacktrace.Propagate(err, "")
		}
		usage, err := c.UsageRepo.GetUsage(userID)
		if err != nil {
			return false, stacktrace.Propagate(err, "")
		}
		if usage > (newStorage + *bonusStorage) {
			return false, stacktrace.Propagate(err, fmt.Sprintf("user with %d usage can not downgrade to %d", usage, newStorage))
		}
	} else {
		bonusStorage, bonErr := c.StorageBonusRepo.GetPaidAddonSurplusStorage(context.Background(), *adminID)
		if bonErr != nil {
			return false, stacktrace.Propagate(err, "")
		}
		usage, err := c.UsageRepo.StorageForFamilyAdmin(*adminID)
		if err != nil {
			return false, stacktrace.Propagate(err, "")
		}
		if usage > (newStorage + *bonusStorage) {
			return false, stacktrace.Propagate(err, fmt.Sprintf("familyUser with %d usage can not downgrade to %d", usage, newStorage))
		}
	}
	return true, nil
}