anchor.diff:  	{<<"err">>, undefined} -> success;
   	_Else -> protocolError
       end.
  -
  -%% @doc Replace an attribute:value pair in an LDAP object
  -%% @spec object_modify(Key, Value, Entry) -> Entry
  -%%       Key -> list() | bitstring()
  -%%       Value -> list() | bitstring() | tuple()
  -%%       Entry -> list()
  -object_modify(Key, Value, Entry) when is_list(Key) ->
  -    object_modify(list_to_bitstring(Key), Value, Entry);
  -object_modify(Key, Value, Entry) when is_bitstring(Key),
  -				      is_list(Value) ->
  -    object_modify(Key, list_to_bitstring(Value), Entry);
  -object_modify(Key, Value, Entry) when is_bitstring(Key),
  -				      is_bitstring(Value) orelse 
  -				      is_tuple(Value) ->
  -    lists:keyreplace(Key, 1, Entry, {Key, Value}).
  -
  -%% @doc Get an attribute:value pair from an LDAP object
  -%% @spec object_get(Key, Entry) -> Item | false
  -%%       Key -> list() | bitstring()
  -%%       Item -> tuple()
  -object_get(Key, Entry) when is_list(Key) ->
  -    object_get(list_to_bitstring(Key), Entry);
  -object_get(Key, Entry) when is_bitstring(Key) ->
  -    element(2, lists:keyfind(Key, 1, Entry)).
  -
  -%% @doc Insert a new attribute:value pair into an LDAP object
  -%% @spec object_insert(Key, Value, Entry) -> Entry
  -%%       Key -> list() | bitstring()
  -%%       Value -> list() | bitstring() | tuple()
  -%%       Entry -> list()
  -object_insert(Key, Value, Entry) when is_list(Key) ->
  -    object_insert(list_to_bitstring(Key), Value, Entry);
  -object_insert(Key, Value, Entry) when is_bitstring(Key),
  -				      is_list(Value) ->
  -    object_insert(Key, list_to_bitstring(Value), Entry);
  -object_insert(Key, Value, Entry) when is_bitstring(Key),
  -				      is_bitstring(Value) orelse
  -				      is_tuple(Value) ->
  -    [{Key, Value} | Entry].
  -
  -%% @doc Delete an attribute:value pair from an LDAP object
  -%% @spec object_delete(Key, Entry) -> Entry
  -%%       Key -> list() | bitstring()
  -%%       Entry -> list()
  -object_delete(Key, Entry) when is_list(Key) ->
  -    object_delete(list_to_bitstring(Key), Entry);
  -object_delete(Key, Entry) when is_bitstring(Key) ->
  -    lists:keydelete(Key, 1, Entry).
   
   %% @doc Create a reveresed DN from a DN
   %% @spec rdn(DN) -> DN
  
positive.code: %% @doc Apply ModifyRequest change atoms to an object
  modify_apply({'ModifyRequest_changes_SEQOF', add, Change}, Entry) ->
      {Key, Value} = attribute_to_item(Change),
      object_insert(Key, Value, Entry);
  modify_apply({'ModifyRequest_changes_SEQOF', replace, Change}, Entry) ->
      {Key, Value} = attribute_to_item(Change),
      object_modify(Key, Value, Entry);
  modify_apply({'ModifyRequest_changes_SEQOF', delete, Change}, Entry) ->
      {Key,_Value} = attribute_to_item(Change),
      object_delete(Key, Entry).
  
  %% @doc Parse eMongo response code
  parse_response([Response]) ->
  
negative.code: bind_reply(_From, [],_MessageID) ->
      invalidCredentials;
  bind_reply(From, [BindResult],_MessageID) when is_list(BindResult) ->
      BindDN = bitstring_to_list(ldap_obj:get("dn", BindResult)),
      ldap_fsm:set_bind(From, BindDN),
      success.
  
  