public City CreateCity(City city)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.CreateCity");
         db.AddInputParameter("@StateId", DbType.Int32, city.StateId);
         db.AddInputParameter("@State", DbType.String, city.State);
         db.AddInputParameter("@Name", DbType.String, city.Name);
         db.AddInputParameter("@PostalCode", DbType.String, city.PostalCode);                
         db.AddInputParameter("@Latitude", DbType.Double, city.Latitude);
         db.AddInputParameter("@Longitude", DbType.Double, city.Longitude);
         db.AddOutputParameter("@CityId", DbType.Int32);
         try
         {
             db.ExecuteNonQuery();
             city.CityId = db.GetParameterValue<int>("@CityId");
         }
         catch (Exception ex)
         {
             Logger.Error("Error while creating city.", ex);
             throw;
         }
     }
     return city;
 }
 public bool TryGetCity(string city, string state, string postalCode, string country, out City match)
 {
     using (var db = new DataAccess())
     {
         db.CreateStoredProcCommand("dbo.TryGetCity");
         db.AddInputParameter("@City", DbType.String, city);
         db.AddInputParameter("@State", DbType.String, state);
         db.AddInputParameter("@PostalCode", DbType.String, postalCode);
         db.AddInputParameter("@Country", DbType.String, country);
         db.AddReturnParameter();
         try
         {
             db.ReadInto(match = new City());
             return Convert.ToBoolean(db.GetReturnValue());
         }
         catch (Exception ex)
         {
             Logger.Error("Error while getting country.", ex);
         }
     }
     match = default(City);
     return false;
 }