uri = uri.removeLastSegment();
final String realmId = uri.lastSegment().toString();
final AbstractRealm realm = (AbstractRealm)findRealmForRealmId(realmId);
final Configuration conf = Configurator.parse(document);
Integer id = -1;
if(isRemoved) {
id = conf.getPropertyInteger("id");
}
final String name = conf.getProperty("name");
if(isAccount) {
if (isRemoved && id > 2 && !hasUser(id)) {
final AccountImpl account = new AccountImpl( realm, conf );
account.removed = true;
addUser(account.getId(), account);
} else if(name != null) {
if (realm.hasAccount(name)) {
final Integer oldId = saving.get(document.getURI());
final Integer newId = conf.getPropertyInteger("id");
//XXX: resolve conflicts on ids!!!
if (!newId.equals(oldId)) {
final Account current = realm.getAccount(name);