public override bool DeleteUser(string username, bool deleteAllRelatedData) { try { using (TransactionScope transaction = new TransactionScope(mConfiguration)) { if (deleteAllRelatedData) { Roles.UserInRoleDataStore userInRoleStore = new Eucalypto.Roles.UserInRoleDataStore(transaction); IList<Roles.UserInRole> userInRoles = userInRoleStore.FindForUser(ApplicationName, username); foreach (Roles.UserInRole ur in userInRoles) userInRoleStore.Delete(ur.Id); } UserDataStore dataStore = new UserDataStore(transaction); User user = dataStore.FindByName(ApplicationName, username); if (user == null) throw new UserNotFoundException(username); dataStore.Delete(user.Id); transaction.Commit(); } return true; } catch (Exception ex) { LogException(ex, "DeleteUser"); return false; } }