public bool checkStaffField(string input) { bool isExist= false; Thread checkStaff = new Thread(()=> { switch (this.Field) { case "username": isExist = StaffModel.checkUniqueStaffUsername(input); break; case "email": isExist = StaffModel.checkUniqueStaffEmail(input); break; default: isExist = false; break; } }); checkStaff.SetApartmentState(ApartmentState.STA); checkStaff.Start(); checkStaff.Join(); return isExist; }