public (bool Saved, ushort Id) TryAddContent(byte[] content, uint typeId) { // data are specific to one data type if (typeId != Header.PageTypeId) { return(false, 0); } var compressedContent = content; if (compressedContent.Length > this.Header.PageNumberOfFreeBytes) { return(false, 0); } // its enough space in this page // now find the place to save var sliceIterator = _pageMemorySlice.Slice(0); var foundEmptySlot = FindEmptySlot(ref sliceIterator); if (!foundEmptySlot) { return(false, 0); } Document.Document document = new Document.Document(sliceIterator, this.Header.PageNextDocumentId); document.Update(content); //this._cachedDocuments.Add(document.DocumentId, document); this.IsDirty = true; ref PageHeader header = ref Header;