//return the Product Entity via fetch
EntityCollection productRetrieve = service.RetrieveMultiple(new FetchExpression(fetch));
Entity prodAnnualSupport = productRetrieve.Entities[0];
//Retrieve the Opportunity record from the opportunity "name"
QueryByAttribute oppQuery = new QueryByAttribute {
EntityName = "opportunity",
ColumnSet = new ColumnSet("name", "description", "opportunityid")
};
oppQuery.AddAttributeValue("name", oppTopic.Get<string>(context));
EntityCollection oppResults = service.RetrieveMultiple(oppQuery);
Entity oppAnnualSupport = oppResults.Entities[0];
//Debug code: update the description field
oppAnnualSupport["description"] = prodAnnualSupport["name"].ToString();
service.Update(oppAnnualSupport);
//Create the Opportunity Product Line and associate with the Opportunity
OpportunityProduct newOpportunityProduct = new OpportunityProduct();
newOpportunityProduct.ProductId = new EntityReference(Product.EntityLogicalName, prodAnnualSupport.Id);
newOpportunityProduct.OpportunityId = new EntityReference(Opportunity.EntityLogicalName, oppAnnualSupport.Id);
newOpportunityProduct.Quantity = (decimal) 1.000;
Guid oppProdId = service.Create(newOpportunityProduct);