public Car UpdateCar(Car car)
 {
     using (var context = new MaintenanceTrackerContext())
     {
         context.Cars.Attach( car );
         context.Entry( car ).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
         return car;
     }
 }
 public CarDTO Convert(Car car)
 {
     return new CarDTO {
         Id = car.Id,
         Year = car.Year,
         Make = car.Make,
         Model = car.Model,
         Name = car.Name,
         Vin = car.Vin
     };
 }
        public Car CreateCar(Car car)
        {
            using ( var context = new MaintenanceTrackerContext() )
            {
                if ( context.Makes.Find( car.CarMakeId ) != null )
                {
                    car.Make = null;
                }

                if ( context.Models.Find( car.CarModelId ) != null )
                {
                    car.Model = null;
                }
                context.Cars.Add( car );
                context.SaveChanges();
                return car;
            }
        }