Where is your code running? Web part, application page etc?
Regardless, you can probably do something similar to the following
try
{
//first get the SPGroup you want to add users to
SPGroup addToGroup = SPContext.Current.Web.AssociatedVisitorGroup;
//now loop through each entity in your user picker
foreach (PickerEntity entity in userPicker.ResolvedEntities)
{
//entity key will be the username
string userName = entity.Key;
//create a SPUser in the web
SPUser user = SPContext.Current.Web.EnsureUser(userName);
if (user.IsDomainGroup)
{
//user is an ad group
}
else
{
//user is an ad user
}
//add the user to the group
addToGroup.AddUser(user);
}
}
catch (UnauthorizedAccessException uaex)
{
//handle any errors that occur when not enough rights to manage users
}
catch (Exception)
{
//handle other errors
}