public NccWebSiteWidget Update(NccWebSiteWidget entity)
        {
            var oldEntity = _entityRepository.Get(entity.Id);

            if (oldEntity != null)
            {
                using (var txn = _entityRepository.BeginTransaction())
                {
                    CopyNewData(oldEntity, entity);
                    _entityRepository.Edit(oldEntity);
                    _entityRepository.SaveChange();
                    txn.Commit();
                }
            }

            return(entity);
        }
        public string DownOrder(long zoneWidgetId, int oldOrder)
        {
            var entity = _entityRepository.Get(zoneWidgetId);

            if (entity == null)
            {
                return("Error: No zone widget found");
            }

            var widgetOrder = entity.WidgetOrder;

            var upEntityList = Load(entity.ThemeId, entity.LayoutName, entity.Zone);

            foreach (var item in upEntityList)
            {
                if (item.WidgetOrder == widgetOrder + 1)
                {
                    item.WidgetOrder -= 1;
                    _entityRepository.Edit(item);
                }
            }
            entity.WidgetOrder += 1;
            //var upEntityList = LoadNext(entity.ModuleName, entity.ThemeId, entity.LayoutName, entity.Zone, widgetOrder);
            //foreach (var item in upEntityList)
            //{
            //    //Skip entity new order number
            //    if (widgetOrder == entity.WidgetOrder)
            //    {
            //        widgetOrder++;
            //    }
            //    item.WidgetOrder = widgetOrder++;
            //    _entityRepository.Edit(item);
            //}

            _entityRepository.Edit(entity);
            _entityRepository.SaveChange();
            return("Success: update successful");
        }