private void btnSaveCar_Click(object sender, EventArgs e) { Car car = CreateNewCar(); if (client.GetCarByRegNr(car.RegNumber = txtRegNr.Text) != null) { MessageBox.Show("Car with this registration number is already in database," + "please try again!"); } else { var theCarId = client.AddCar(car); MessageBox.Show("Car saved"); txtRegNr.Text = string.Empty; txtModel.Text = string.Empty; txtManYear.Text = string.Empty; txtBrand.Text = string.Empty; } }