FYI, I was trying to clean up the persisted temporary files after uploading the files to the database but the files were not being released when I tried to call DeleteAllDocuments after calling OpenStream. The correct call is as follows:
using (Stream stream = AttachmentItem.OpenStream())
{
stream.Read(byteArraydata, 0, AttachmentItem.FileSize);
}
//save to database
//call DeleteAllAttachments();
Hope this helps others...