Design a C# application using WPF to manage a simple contact list with fields like name, phone number, and email address. Implement data validation checks and persist the contact list data in a local SQLite database.
PLAINFORMAT
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data.Entity;
using System.Runtime.CompilerServices;
using System.Windows;

namespace ContactListApp
{
    public class Contact
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string PhoneNumber { get; set; }
        public string EmailAddress { get; set; }
    }

    public class ContactsDbContext : DbContext
    {
        public DbSet<Contact> Contacts { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlite("Data Source=contacts.db");
        }
    }

    public class MainViewModel : INotifyPropertyChanged
    {
        private ObservableCollection<Contact> _contacts;
        public ObservableCollection<Contact> Contacts
        {
            get => _contacts;
            set
            {
                _contacts = value;
                OnPropertyChanged();
            }
        }

        // Implement other properties and methods for adding, updating, and deleting contacts.

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public partial class MainWindow : Window
    {
        private MainViewModel _viewModel;

        public MainWindow()
        {
            InitializeComponent();
            _viewModel = new MainViewModel();
            DataContext = _viewModel;
        }

        private void AddContact_Click(object sender, RoutedEventArgs e)
        {
            // Validate input fields
            if (string.IsNullOrWhiteSpace(txtName.Text) || string.IsNullOrWhiteSpace(txtPhoneNumber.Text) || string.IsNullOrWhiteSpace(txtEmailAddress.Text))
            {
                MessageBox.Show("All fields are required.");
                return;
            }

            // Create a new contact and add it to the database
            var contact = new Contact
            {
                Name = txtName.Text,
                PhoneNumber = txtPhoneNumber.Text,
                EmailAddress = txtEmailAddress.Text
            };

            _viewModel.AddContact(contact);

            // Clear input fields
            txtName.Clear();
            txtPhoneNumber.Clear();
            txtEmailAddress.Clear();
        }
    }

    public void AddContact(Contact contact)
    {
        using (var db = new ContactsDbContext())
        {
            db.Contacts.Add(contact);
            db.SaveChanges();
        }

        LoadContacts();
    }

    public void UpdateContact(Contact contact)
    {
        using (var db = new ContactsDbContext())
        {
            db.Entry(contact).State = EntityState.Modified;
            db.SaveChanges();
        }

        LoadContacts();
    }

    public void DeleteContact(Contact contact)
    {
        using (var db = new ContactsDbContext())
        {
            db.Entry(contact).State = EntityState.Deleted;
            db.SaveChanges();
        }

        LoadContacts();
    }

    private void LoadContacts()
    {
        using (var db = new ContactsDbContext())
        {
            Contacts = new ObservableCollection<Contact>(db.Contacts.ToList());
        }
    }
}