I have a console app, it updates people or group field of sharepoint list. If the item["Approver"] value is a user value this app works fine. If the item["Approver"] value is a sharepoint group this will fail.
I expect this app should work if the item["Approver"] value is both user or group. Can someone suggest the code part to make me success?

```
static  SPWeb _web;
static SPSite _site;
static SPList myList;

static void Main(string[] args)
{
    string usercontrolvalue = "test";
    _site = new SPSite("URL");
    _web = _site.OpenWeb();
    _web.AllowUnsafeUpdates = true;
    myList = _web.Lists["MYList"];
    SPListItem item = myList.Items.Add();
    SPFieldUserValueCollection usercollection = new SPFieldUserValueCollection();
    string[] userarray = usercontrolvalue.Split(',');
    for (int i = 0; i < userarray.Length; i++)
    {
        SPFieldUserValue usertoadd = ConvertLoginName(userarray[i]);
        usercollection.Add(usertoadd);
    }
    item["Approver"] = usercollection;
    item.Update();
}

public static SPFieldUserValue ConvertLoginName(string userid)
{
    SPUser requireduser = _web.EnsureUser(userid);
    SPFieldUserValue uservalue = new SPFieldUserValue(_web, requireduser.ID, requireduser.LoginName);
    return uservalue; 
}

```