for an project we are using the liferay and for the user handling we are using the ldap.

The user when deleted from the ldap is not updating the database of the liferay and hence if a user to be added after deleting it, it is causing the problem.

I tried to found out the cause and seems like one has to delete the users from many tables. Manually we can delete it like mentioned below.

```
DELETE FROM Users_UserGroups WHERE userId = 'userid';
DELETE FROM Users_Roles WHERE userId = 'userid';
DELETE FROM Users_Orgs WHERE userId = 'userid';
DELETE FROM Contact_ WHERE userId = 'userid';
DELETE FROM Group_ WHERE classPK = 'userid';
DELETE FROM User_ WHERE userId = 'userid';

```

but programatically how can we do that.

I tried using: 

```
UserLocalServiceUtil.deleteUser(UserLocalServiceUtil
                        .getUserByEmailAddress(companyid, email));

```

But its not working properly. what are the other ways to do that?