public int MaintainContactDetails(personObject.Contact contact)
        {
            if (string.IsNullOrWhiteSpace(contact.PhoneNumber))
            {
                return(0);
            }

            try
            {
                using (var context = new AddressBookEntities())
                {
                    //Update Contact
                    if (contact.Id > 0)
                    {
                        var contactObj = context.AddressBooks.Where(c => c.Id == contact.Id).First();

                        contactObj.EmailAddress = contact.EmailAddress;
                        contactObj.PhoneNumber  = contact.PhoneNumber;
                        contactObj.UserId       = contact.UserId;
                        return(context.SaveChanges());
                    }

                    //Add New Contact

                    context.AddressBooks.Add(new AddressBook()
                    {
                        EmailAddress = contact.EmailAddress,
                        PhoneNumber  = contact.PhoneNumber,
                        UserId       = contact.UserId
                    });

                    return(context.SaveChanges());
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public int DeleteContactDetails(personObject.Contact contact)
        {
            if (contact.Id == 0)
            {
                return(0);
            }

            try
            {
                using (var context = new AddressBookEntities())
                {
                    var contactObj = context.AddressBooks.Where(c => c.Id == contact.Id).First();

                    context.AddressBooks.Remove(contactObj);

                    return(context.SaveChanges());
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }