public bool AddAddress(string Address1, string PostCode, int? CountryID, string Town, string County )
        {
            try
            {
                var addr = new Address();
                // check town exits, if not add town
                if (Town != "")
                {
                    var lsTown = _db.Towns.Where(m => m.TownName == Town && m.CountryID == CountryID);
                    if (lsTown.Count() != 0)
                    {
                        addr.TownID = lsTown.First().TownID;
                    }
                    else
                    {
                        var town = new Town();
                        town.TownName = Town;
                        town.CountryID = CountryID;
                        var re = CreateTown(town);
                        if (re == false)
                            return false;
                        addr.TownID = town.TownID;
                    }
                }

                // check county exits, if not add county
                if (County != "")
                {
                    var lsCounty = _db.Counties.Where(m => m.CountyName == County && m.CountryID == CountryID);
                    if (lsCounty.Count() != 0)
                    {
                        addr.CountyID = lsCounty.First().CountyID;
                    }
                    else
                    {
                        var county = new County();
                        county.CountyName = County;
                        county.CountryID = CountryID;
                        var re = CreateCounty(county);
                        if (re == false)
                            return false;
                        addr.CountyID = county.CountyID;
                    }
                }
                addr.CountryID = CountryID;
                addr.PostCode = PostCode;
                addr.Address1 = Address1;
                CreateAddress(addr);
                return true;
            }
            catch
            {
                return false;
            }
        }
		private void detach_Towns(Town entity)
		{
			this.SendPropertyChanging();
			entity.Country = null;
		}
		private void attach_Towns(Town entity)
		{
			this.SendPropertyChanging();
			entity.Country = this;
		}
 partial void DeleteTown(Town instance);
 partial void UpdateTown(Town instance);
 partial void InsertTown(Town instance);
 public bool CreateTown(Town town)
 {
     try
     {
         _db.Towns.InsertOnSubmit(town);
         _db.SubmitChanges();
         return true;
     }
     catch
     {
         return false;
     }
 }