public async Task <IActionResult> ExportEntities([FromBody] ODataActionParameters request)
        {
            Condition.Requires <ODataActionParameters>(request, nameof(request)).IsNotNull <ODataActionParameters>();
            if (!request.ContainsKey("entityType") || request["entityType"] == null)
            {
                return((IActionResult) new BadRequestObjectResult((object)request));
            }
            string entityType = request["entityType"].ToString();

            try
            {
                InitializeEnvironment();

                var exportEntitiesArgument = new ExportEntitiesArgument
                {
                    EntityType = entityType
                };
                var command = this.Command <ExportCommerceEntitiesCommand>();
                var result  = await command.Process(this.CurrentContext, exportEntitiesArgument);

                var jsonSerializerSettings = new JsonSerializerSettings
                {
                    TypeNameHandling = TypeNameHandling.All
                };
                return(new JsonResult(result, jsonSerializerSettings));
            }
            catch (Exception ex)
            {
                return(new ObjectResult(ex));
            }
        }
 /// <summary>
 /// Process
 /// </summary>
 /// <param name="commerceContext">commerceContext</param>
 /// <returns>true if the process was successful</returns>
 public async Task <EntityCollectionModel> Process(CommerceContext commerceContext, ExportEntitiesArgument arg)
 {
     using (var activity = CommandActivity.Start(commerceContext, this))
     {
         return(await this._pipeline.Run(arg, new CommercePipelineExecutionContextOptions(commerceContext)));
     }
 }