public bool EditInventory(InventoryViewModel inventoryViewModel) { var car = _mapper.Map <Car>(inventoryViewModel); car = NullifyDependantEntities(car); var inventoryId = inventoryViewModel.Id.ToString(); var inventory = _inventoryRepository.GetInventoryDetailsById(inventoryId); if (inventory == null) { return(false); } if (inventory.CarId == null || inventory.CarId == Guid.Empty) { return(false); } car = ManageCarAttributes(inventoryViewModel, car); string carId = inventory.CarId.ToString(); _carRepository.EditCar(carId, car); var updatedInventory = _mapper.Map <Inventory>(inventoryViewModel); _inventoryRepository.EditInventory(updatedInventory); var repairDetails = _mapper.Map <Repair>(inventoryViewModel); _repairRepository.EditRepair(carId, repairDetails); RemoveExistingFiles(inventoryId); return(true); }