if (!oLst.isEmpty()) throw new IllegalArgumentException(sBusinessName+" already exists");
Log.out.debug("PROFILING: Search Business Name "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
lStart = lEnd;
Dms oDms = oSes.getDms();
oNew.setDocument (oDms.newDocument(oDms.getDocumentType(oNew.getTypeName()), Zesped.top(oSes).getDocument()));
oNew.put("account_id",Gadgets.generateUUID());
oNew.put("active","1");
oNew.put("business_name",sBusinessName);
oNew.put("creation_date", dtNow);
oNew.put("contact_person", oUsr.getFirstName()+" "+oUsr.getLastName());
oNew.save(oSes);
Log.out.debug("PROFILING: Save CustomerAccount "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
lStart = lEnd;
Log.out.debug("CustomerAccount.createGroups(AtrilSession)");
oNew.createGroups(oSes);
Log.out.debug("PROFILING: Create permissions groups "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
lStart = lEnd;
oNew.grantAdmin(oSes, oUsr);
Log.out.debug("PROFILING: Grant admin permissions "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
lStart = lEnd;
AttributeMultiValue oAttr = oUsr.getDocument().attribute("customer_acount");
oAttr.set(oNew.getUuid());
oUsr.getDocument().save("");
oIdx.indexDocument(oUsr.getDocument());
Document oOrders = oDms.newDocument(oDms.getDocumentType("Orders"), oNew.getDocument());
oOrders.save("");
oIdx.indexDocument(oOrders);
Document oClients = oDms.newDocument(oDms.getDocumentType("Clients"), oNew.getDocument());
oClients.save("");
oIdx.indexDocument(oClients);
Document oPayers = oDms.newDocument(oDms.getDocumentType("TaxPayers"), oNew.getDocument());
oPayers.save("");
oIdx.indexDocument(oPayers);
Document oCredits = oDms.newDocument(oDms.getDocumentType("CustomerAccountCredits"), oNew.getDocument());
oCredits.attribute("account_id").set(oNew.getString("account_id"));
oCredits.attribute("credits_used").set(0l);
oCredits.attribute("credits_left").set(0l);
oCredits.save("");
oIdx.indexDocument(oCredits);