public ActionResult New([Bind(Exclude = "ConstituentID")] Constituent constituent) { if (ModelState.IsValid) { // Determine what the current highest ID is, then increment by one Constituent[] allConstituents = unitOfWork.Constituents.GetConstituents().OrderByDescending(x => x.ConstituentID).ToArray(); int newConstituentID = allConstituents[0].ConstituentID + 1; // Use that number as the ID for this Constituent constituent.ConstituentID = newConstituentID; // Calculate their latitude and longitude Geolocation geo = new Geolocation(); geo.GetGeocode(constituent.getFullAddress()); constituent.Latitude = Convert.ToDecimal(geo.Latitude); constituent.Longitude = Convert.ToDecimal(geo.Longitude); unitOfWork.Constituents.Add(constituent); unitOfWork.Complete(); return(RedirectToAction("Index")); } return(View(constituent)); }