private static Entity ConvertActionToEntity(Models.CRM.Action Action)
 {
     return(new Entity
     {
         Attributes =
         {
             new KeyValuePair <string, object>("msdyusd_agentscriptactionid", Action.Id),
             new KeyValuePair <string, object>("msdyusd_name",                Action.Name),
             new KeyValuePair <string, object>("msdyusd_order",               Action.Order),
             //EntityReferences
             new KeyValuePair <string, object>("msdyusd_actiondata",          Action.Data),
             new KeyValuePair <string, object>("msdyusd_condition",           Action.Condition),
             new KeyValuePair <string, object>("msdyusd_shortcutkey",         Action.ShortcutKey)
         }
     });
 }
        public static void UpdateAction(IOrganizationService service, Models.CRM.Action Action)
        {
            var entity = ConvertActionToEntity(Action);

            service.Update(entity);
        }