public ActionResult Appliances_Create([DataSourceRequest]DataSourceRequest request, AdministerApplianceViewModel appliance)
        {
            var newId = 0;
            if (ModelState.IsValid)
            {
                var entity = new Appliance
                {
                    Name = appliance.Name,
                    Type = appliance.Type,
                    Power = appliance.Power,
                    Input = appliance.Input,
                    Output = appliance.Output,
                    ManufacturerId = this.User.Identity.GetUserId()
                };

                this.appliances.Add(entity);
                this.appliances.SaveChanges();
                newId = entity.Id;
            }
            var applianceToDisplay = this.appliances
                .All()
                .To<AdministerApplianceViewModel>()
                .FirstOrDefault(x => x.Id == newId);
            return Json(new[] { applianceToDisplay }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult Appliances_Update([DataSourceRequest]DataSourceRequest request, AdministerApplianceViewModel appliance)
        {   
            if (ModelState.IsValid)
            {
                var entity = this.appliances.GetById(appliance.Id);
                entity.Name = appliance.Name;
                entity.Type = appliance.Type;
                entity.Power = appliance.Power;
                entity.Input = appliance.Input;
                entity.Output = appliance.Output;
                
                this.appliances.SaveChanges();
            }

            var applianceToDisplay = this.appliances
               .All()
               .To<AdministerApplianceViewModel>()
               .FirstOrDefault(x => x.Id == appliance.Id);

            return Json(new[] { applianceToDisplay }.ToDataSourceResult(request, ModelState));
        }