public void AddModel(CarModelView carModel) { User user = new User(); using (_ctx = new GuildCarsEntities()) { try { var userInfo = _ctx.GetUserByName(carModel.User); foreach (var u in userInfo) { user.Email = u.Email; } _ctx.AddVehicleModel(carModel.ModelName, carModel.CarMakeId, user.Email); } catch (Exception ex) { throw ex; } } }