private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (cmbDistrictName.SelectedValue == null)
            {
                DISTRICT district = new DISTRICT();
                district.DISTRICT_NAME = cmbDistrictName.Text;
                data.Insert<DISTRICT>(district);
            }
            if (cmbTalukName.SelectedValue == null)
            {
                TALUK taluk = new TALUK();
                taluk.TALUK_NAME = cmbTalukName.Text;
                taluk.DISTRICT_ID = selectedDistrict = cmbDistrictName.SelectedValue == null ? data.GetAll<DISTRICT>().Max(s => s.DISTRICT_ID) : Convert.ToInt32(cmbDistrictName.SelectedValue);
                data.Insert<TALUK>(taluk);
            }
            if (null != txtVillageName.Text && txtVillageName.Text != string.Empty)
            {
                VILLAGE village = new VILLAGE();
                village.VILLAGE_NAME = txtVillageName.Text;
                village.TALUK_ID = selectedTaluk = cmbTalukName.SelectedValue == null ? data.GetAll<TALUK>().Max(s => s.TALUK_ID) : Convert.ToInt32(cmbTalukName.SelectedValue);
                data.Insert(village);
                MessageBox.Show("New Village Added Succesfully.");
            }

            txtVillageName.Text = string.Empty;

            BindGrid();
            cmbDistrictName.ItemsSource = data.GetAll<DISTRICT>().Select(s => new { Id = s.DISTRICT_ID, Name = s.DISTRICT_NAME });
            cmbDistrictName.SelectedValue = cmbDistrictName.SelectedValue == null ? selectedDistrict : Convert.ToInt32(cmbDistrictName.SelectedValue); ;
            cmbTalukName.ItemsSource = data.GetAll<TALUK>(s => s.DISTRICT_ID == Convert.ToInt32(cmbDistrictName.SelectedValue)).Select(s => new { Id = s.TALUK_ID, Name = s.TALUK_NAME });
            cmbTalukName.SelectedValue = cmbTalukName.SelectedValue == null ? selectedTaluk : Convert.ToInt32(cmbTalukName.SelectedValue);
        }
 partial void DeleteTALUK(TALUK instance);
 partial void UpdateTALUK(TALUK instance);
 partial void InsertTALUK(TALUK instance);
		private void detach_TALUKs(TALUK entity)
		{
			this.SendPropertyChanging();
			entity.DISTRICT = null;
		}
		private void attach_TALUKs(TALUK entity)
		{
			this.SendPropertyChanging();
			entity.DISTRICT = this;
		}