anchor.diff:      % when
       First = getFirstSeq(Node1),
       subscribe(First, <<"endpoint1">>, SubscribeParams1),
  -
  -    SpaceKey1 = <<"spacekey1">>,
  -    SpaceDoc1 = #document{key = SpaceKey1, value = #space{name = <<"space1">>, providers = [ProviderID1]}},
  -    ?assertEqual({ok, SpaceKey1}, rpc:call(Node1, space, save, [SpaceDoc1])),
  -
  -    await_communication(Node1, <<"endpoint1">>, space_msg(SpaceDoc1)),
  +    SpaceDoc1 = save(Node1, <<"spacekey1">>, #space{name = <<"space1">>, providers = [ProviderID1], groups = []}),
  +
  +    await_communication(Node1, <<"endpoint1">>, SpaceDoc1),
       Later = getFirstSeq(Node1),
       subscribe(Later, <<"endpoint1">>, SubscribeParams2),
  -
  -    SpaceKey2 = <<"spacekey2">>,
  -    SpaceDoc2 = #document{key = SpaceKey2, value = #space{name = <<"space2">>, providers = [ProviderID1], groups = []}},
  -    ?assertEqual({ok, SpaceKey2}, rpc:call(Node1, space, save, [SpaceDoc2])),
  +    SpaceDoc2 = save(Node1, <<"spacekey2">>, #space{name = <<"space2">>, providers = [ProviderID1], groups = []}),
   
       % then
  -    verify_communication(Node1, <<"endpoint1">>, [space_msg(SpaceDoc1)], [space_msg(SpaceDoc2)]),
  -    verify_communication(Node2, <<"endpoint1">>, [space_msg(SpaceDoc2)], [space_msg(SpaceDoc1)]),
  +    verify_communication(Node1, <<"endpoint1">>, [SpaceDoc1], [SpaceDoc2]),
  +    verify_communication(Node2, <<"endpoint1">>, [SpaceDoc2], [SpaceDoc1]),
       ok.
   
   
  
positive.code:             verify_communication(Node, Endpoint, Remaining, ForbiddenChanges, Request + 1, ?ALLOWED_FAILURES)
      end.
  
  space_msg(SpaceDoc) ->
      #document{key = ID, value = #space{name = Name, groups = Groups, users = Users}} = SpaceDoc,
      {<<"space">>, [{<<"id">>, ID}, {<<"name">>, Name}, {<<"groups">>, Groups}, {<<"users">>, Users}]}.
  
  mock_capture(Node, Args) ->
  
negative.code:         rpc:call(Node, couchdb_datastore_driver, db_run,
              [couchbeam_changes, follow_once, [], 3])
      ),
      binary_to_integer(LastSeqInDb).
  
  save(Node, Key, Value) ->
      Doc = #document{key = Key, value = Value},
      ?assertEqual({ok, Key}, rpc:call(Node, space, save, [Doc])),
      Doc.