public static IndexedDocument loadDocument(string directory, Guid filename)
        {
            try
            {
                var localFilename = directory + filename.ToString();
                if(IndexedDocument.cache.ContainsKey(localFilename))
                {
                    return IndexedDocument.cache[localFilename];
                }

                var newDoc = new IndexedDocument();
                if(!File.Exists(localFilename))
                {
                    return newDoc;
                }

                newDoc.name = filename;
                var list = new List<uint>(500000);
                using(var file = File.OpenRead(localFilename))
                {
                    using(var binaryStream = new BinaryReader(file))
                    {
                        while(true)
                        {
                            try
                            {
                                list.Add(binaryStream.ReadUInt32());
                            }
                            catch(EndOfStreamException)
                            {
                                newDoc.words = list.ToArray();
                                break;
                            }
                        }
                    }
                }

                lock(IndexedDocument.locking)
                {
                    if(!IndexedDocument.cache.ContainsKey(localFilename))
                    {
                        IndexedDocument.cache[localFilename] = newDoc;
                    }
                }

                return newDoc;
            }
            catch
            {
                return new IndexedDocument();
            }
        }
        public static IndexedDocument createDocument(string directory, Guid name, uint[] words)
        {
            var newDoc = new IndexedDocument();
            newDoc.name = name;
            newDoc.words = words;

            var data = new List<byte>(words.Length * 4);
            foreach(var word in newDoc.words)
            {
                data.AddRange(BitConverter.GetBytes(word));
            }

            File.WriteAllBytes(directory + name.ToString(), data.ToArray());
            return newDoc;
        }