Try to clear the cache by using below code before creating user.
if (Sitecore.Context.ClientData != null)
{
var ClientDataValues = Sitecore.Context.ClientData.GetValueNames();
if (ClientDataValues != null && ClientDataValues.Any())
{
var KeyName = "SC_USR_" + userName;
var clientDataValue = Sitecore.Context.ClientData.GetValue(KeyName);
if (clientDataValue != null)
{
Sitecore.Context.ClientData.RemoveValue(KeyName);
}
}
}
if (Sitecore.Context.ClientData != null)
{
var ClientDataValues = Sitecore.Context.ClientData.GetValueNames();
if (ClientDataValues != null && ClientDataValues.Any())
{
var KeyName = "SC_USR_" + userName;
var clientDataValue = Sitecore.Context.ClientData.GetValue(KeyName);
if (clientDataValue != null)
{
Sitecore.Context.ClientData.RemoveValue(KeyName);
}
}
}
Give it a try and let me know.