func NewBag(location string, name string, hashNames []string, createTagManifests bool) (*Bag, error) {
	bag := new(Bag)
	if bag.Manifests == nil {
		bag.Manifests = make([]*Manifest, 0)
	}
	bag.pathToFile = filepath.Join(location, name)
	err := os.Mkdir(bag.pathToFile, 0755)
	if err != nil {
		return nil, err
	}
	for _, hashName := range hashNames {
		lcHashName := strings.ToLower(hashName)
		manifest, err := NewManifest(bag.Path(), lcHashName, PayloadManifest)
		if err != nil {
			return nil, err
		}
		bag.Manifests = append(bag.Manifests, manifest)
		if createTagManifests == true {
			tagManifestName := fmt.Sprintf("tagmanifest-%s.txt", lcHashName)
			fullPath := filepath.Join(bag.Path(), tagManifestName)
			tagmanifest, err := NewManifest(fullPath, lcHashName, TagManifest)
			if err != nil {
				return nil, err
			}
			bag.Manifests = append(bag.Manifests, tagmanifest)
		}
	}
	plPath := filepath.Join(bag.Path(), "data")
	err = os.Mkdir(plPath, 0755)
	if err != nil {
		return nil, err
	}
	bag.payload, err = NewPayload(plPath)
	if err != nil {
		return nil, err
	}
	bag.tagfiles = make(map[string]*TagFile)
	bag.excludeFromTagManifests = make(map[string]bool)
	tf, err := bag.createBagItFile()
	if err != nil {
		return nil, err
	}
	bag.tagfiles["bagit.txt"] = tf
	errors := bag.Save()
	if err != nil && len(errors) > 0 {
		message := ""
		for _, e := range errors {
			message = fmt.Sprintf("%s, %s", message, e.Error())
		}
		return nil, fmt.Errorf(message)
	}
	return bag, nil
}
METHODS FOR CREATING AND INITALIZING BAGS
/*
Creates a new bag under the location directory and creates a bag root directory
with the provided name.  Returns an error if the location does not exist or if the
bag already exist.

This constructor will automatically create manifests with the
specified hash algorithms. Supported algorithms include:

"md5", "sha1", "sha256", "sha512", "sha224" and "sha384"

If param createTagManifests is true, this will also create tag manifests
with the specified algorithms.

example:
NewBag("archive/bags", "bag-34323", ["sha256", "md5"], true)
package bagins
import (
	"github.com/APTrust/bagins/bagutil"
	"fmt"
	"io"
	"log"
	"os"
	"path/filepath"
	"strings"
)
type Bag struct {
	pathToFile              string  
	payload                 *Payload
	Manifests               []*Manifest
	tagfiles                map[string]*TagFile  
	excludeFromTagManifests map[string]bool
}