Q:

Copy PhoneCall `to` and `from` fields to the new PhoneCall

I'm making a button on PhoneCall ribbon that creates follow up call.  I've tried to do this with javascript, with XrmServiceToolkit.  Looks like I can't do it at all with SOAP end point and doing it with REST is some what tricky. 
How do I copy to and from fields to a new activity? 
Update Originally I tried using XrmServiceToolkit javascript library, but switched to C# for copying fields, following Peter's answer. 
Still, no result.  I do it this way:
EntityCollection toCollection = new EntityCollection();
foreach (var activityParty in ((EntityCollection)previousActivity["to"]).Entities)
{
    Entity newActivityParty = new Entity(ActivityParty. EntityLogicalName);
    newActivityParty["activityid"] = new EntityReference(context. PrimaryEntityName, context. PrimaryEntityId);
    newActivityParty["partyid"] = activityParty["partyid"];
    newActivityParty["participationtypemask"] = new OptionSetValue(2);//activityParty["participationtypemask"];
    //service. Create(newActivityParty);

    toCollection. Entities. Add(newActivityParty);
}
entity["to"] = toCollection;

What's the right way to do it? 

A:

Ended up doing it with JavaScript, after all:
function main() {
    var newActivity = new XrmServiceToolkit. Soap. BusinessEntity('phonecall');

    newActivity.attributes['phonecall'] = {
        id : Xrm. Page.data.entity.getId(),
        logicalName : 'phonecall',
        type : 'EntityReference'
    }

    newActivity.attributes['to'] = {
        type: 'EntityCollection',
        value: lookupToEntityReferenceCollection('to')
    }

    var newId = XrmServiceToolkit. Soap. Create(newActivity);
}

function lookupToEntityReferenceCollection(lookupName) {
    var result = [],
        lookupValue = Xrm. Page.getAttribute(lookupName).getValue();

    if (lookupValue === null) {return result;}

    var arrayLength = lookupValue.length;

    for (var i = 0; i < arrayLength;i++) {
        result.push({
            id: lookupValue[i].id, 
            logicalName: lookupValue[i].typename,
            type: 'EntityReference'
        });
    }
    return result;
}

