public override void Delete(string[] ids)
        {
            var orders = GetByIds(ids, CustomerOrderResponseGroup.Full.ToString());

            using (var repository = RepositoryFactory()) {
                var dbOrders = repository.GetCustomerOrdersByIds(ids, CustomerOrderResponseGroup.Full);
                foreach (var order in orders)
                {
                    CustomerOrderEventventPublisher.Publish(new OrderChangeEvent(Platform.Core.Common.EntryState.Deleted, order, order));
                }
                repository.RemoveOrdersByIds(ids);
                foreach (var order in orders)
                {
                    DynamicPropertyService.DeleteDynamicPropertyValues(order);
                }
                repository.UnitOfWork.Commit();
            }
        }
        public override void SaveChanges(CustomerOrder[] orders)
        {
            var pkMap = new PrimaryKeyResolvingMap();

            using (var repository = RepositoryFactory())
                using (var changeTracker = GetChangeTracker(repository)) {
                    var dataExistOrders = repository.GetCustomerOrdersByIds(orders.Where(x => !x.IsTransient()).Select(x => x.Id).ToArray(), CustomerOrderResponseGroup.Full);
                    foreach (var order in orders)
                    {
                        EnsureThatAllOperationsHaveNumber(order);

                        var originalEntity = dataExistOrders.FirstOrDefault(x => x.Id == order.Id);
                        var originalOrder  = originalEntity != null ? (CustomerOrder)originalEntity.ToModel(AbstractTypeFactory <CustomerOrder> .TryCreateInstance()) : order;

                        var changeEvent = new OrderChangeEvent(originalEntity == null ? EntryState.Added : EntryState.Modified, originalOrder, order);
                        CustomerOrderEventventPublisher.Publish(changeEvent);

                        var modifiedEntity = AbstractTypeFactory <CustomerOrderEntity> .TryCreateInstance()
                                             .FromModel(order, pkMap) as CustomerOrderEntity;

                        if (originalEntity != null)
                        {
                            changeTracker.Attach(originalEntity);
                            modifiedEntity.Patch(originalEntity);
                        }
                        else
                        {
                            repository.Add(modifiedEntity);
                        }
                    }
                    CommitChanges(repository);
                    pkMap.ResolvePrimaryKeys();
                }
            //Save dynamic properties
            foreach (var order in orders)
            {
                DynamicPropertyService.SaveDynamicPropertyValues(order);
            }
        }