internal void Write(IDataItem dataItem)
        {
            Check.Require(DesiredFileSize > 0, "Desired file size is invalid");
            Check.RequireArgumentNotNull(dataItem, "dataItem");

            bool written = false;

            // locking to prevent simultaneous flush
            // transaction is necessary within Seek, there's no IO outside it
            lock (this)
            {
                // scope which is dummy unless there's client ambient transaction (pending)
                using (var scope = _transactionManager.GetLazyTransactionScope())
                {
                    _clearDirtyFlagWhenTransactionCompletes = false;

                    if (null != _currentAccessor)
                    {
                        if (_currentAccessor.ItemCount < this.DesiredFileSize || _currentAccessor.IsTimestampCovered(dataItem.DateTime))
                        {
                            written = _currentAccessor.Add(dataItem);
                        }
                    }

                    if (!written)
                    {
                        // item goes into another file
                        // ensure data is stored
                        CloseAccessor();

                        Seek(dataItem.DateTime);
                        // this MUST succeed, checked in postcondition
                        written = _currentAccessor.Add(dataItem);
                    }

                    // it could be false here after flush
                    _dirty = true;

                    if (TrackUnsavedItems)
                    {
                        _unsavedItems.Add(dataItem);
                    }

                    scope.Complete();
                }         // using (var scope = _transactionManager.GetLazyTransactionScope())
            }             // lock (this)

            Check.Ensure(_dirty && written);
        }