// PUT: /api/contactinfo
        public void Put([FromBody] ContactInfoViewModel contactInfoViewModel)
        {
            // Get Person data model from the data service
            // we do not need account nor transactions
            var person = service.GetPerson(authenticatedUser, new PersonIncludes { Accounts = false, Addressses = false, Phones = false, AccountTransactions = false });

            // Update the Email Address in the person model
            person.EmailAddress = contactInfoViewModel.EmailAddress;

            person.Phones = new List<Phone>();
            person.Addresses = new List<PersonAddressAssn>();

            // Add the phone numbers to the person model
            foreach(PhoneViewModel phoneViewModel in contactInfoViewModel.PhoneNumbers)
            {
                if (!string.IsNullOrEmpty(phoneViewModel.Number))
                {
                    var phone = new Phone
                    {
                        PhoneTypeID = phoneViewModel.PhoneTypeID,
                        Number = phoneViewModel.Number
                    };
                    person.Phones.Add(phone);
                }
            }

            // Add the addresses to the person model
            foreach(AddressViewModel addressViewModel in contactInfoViewModel.Addresses)
            {
                if (!string.IsNullOrEmpty(addressViewModel.StreetAddress))
                {
                    var address = new PersonAddressAssn
                    {
                        AddressTypeID = addressViewModel.AddressTypeID,
                        Address = new Address
                        {
                            StreetAddress = addressViewModel.StreetAddress,
                            City = addressViewModel.City,
                            State = addressViewModel.State,
                            Zip = addressViewModel.Zip
                        }
                    };
                    person.Addresses.Add(address);
                }
            }

            // Update the data store
            var oppStatus = service.UpdatePerson(person);

            // Return success or error state
            if (!oppStatus.Success)
            {
                throw new Exception(oppStatus.Messages[0]);
            }
        }
        private void updateAddress(Person person, Person updatedPerson, int addressType, IFootlooseFSUnitOfWork unitOfWork)
        {
            var updatedAddressAssn = updatedPerson.Addresses.Where(a => a.AddressTypeID == addressType).FirstOrDefault();
            if (updatedAddressAssn == null)
            {
                var addressAssn = person.Addresses.Where(a => a.AddressTypeID == addressType).FirstOrDefault();
                if (addressAssn != null)
                {
                    unitOfWork.Addresses.Delete(addressAssn.Address);
                    unitOfWork.PersonAddressAssns.Delete(addressAssn);
                }
            }
            else
            {
                var addressAssn = person.Addresses.Where(a => a.AddressTypeID == addressType).FirstOrDefault();
                if (addressAssn == null)
                {
                    addressAssn = new PersonAddressAssn();
                    addressAssn.PersonID = updatedAddressAssn.PersonID;
                    addressAssn.AddressTypeID = updatedAddressAssn.AddressTypeID;
                    addressAssn.Address = new Address();

                    person.Addresses.Add(addressAssn);

                }

                addressAssn.Address.StreetAddress = updatedAddressAssn.Address.StreetAddress;
                addressAssn.Address.City = updatedAddressAssn.Address.City;
                addressAssn.Address.State = updatedAddressAssn.Address.State;
                addressAssn.Address.Zip = updatedAddressAssn.Address.Zip;
            }
        }