anchor.diff:      ct:print("save begin ~p", [Pid]),
   
       % save block to db
  -    {ok, Uuid} = dao_lib:apply(dao_vfs, save_available_blocks, [Doc], ProtocolVersion),
  +    {ok, Uuid} = dao_lib:apply(dao_vfs, save_available_blocks, [Doc#db_document{force_update = true}], ProtocolVersion),
  +    {ok, NewDoc = #db_document{record = #available_blocks{file_id = FileId, file_size = DocSize = {Stamp, _Value}}}} =
  +        dao_lib:apply(dao_vfs, get_available_blocks, [Doc#db_document{force_update = true}], ProtocolVersion),
   
       % clear cache
  -    FileId = case is_record(Doc, db_document) of true -> Doc#db_document.record#available_blocks.file_id; _ -> Doc#available_blocks.file_id end,
       OldDocs = ets:lookup(CacheName, {FileId, all_docs}),
       OldSize = ets:lookup(CacheName, {FileId, file_size}),
       ets:delete_object(CacheName, {FileId, all_docs}),
  
positive.code: %% High level functions for handling available_blocks document changes
  %% ====================================================================
  %% Every change should pass throught one of this functions
  
  %% synchronize_file_block/3
  %% ====================================================================
  
negative.code:     % create cache again
      case {OldDocs, OldSize} of
          {[{_,Docs}],[{_,Size}]} ->
              OtherDocs = [Document || Document = #db_document{uuid = DocId} <- Docs, DocId =/= Uuid],
              NewDocs = [NewDoc | OtherDocs],
              NewSize =
                  case Size of
                      {S, V} when S > Stamp -> {S, V};
                      _ -> DocSize
                  end,
              ets:insert(CacheName, {{FileId, all_docs}, NewDocs}),
              ets:insert(CacheName, {{FileId, file_size}, NewSize});
          _ -> ok
      end,
      ct:print("save end ~p", [Pid]),
  