public int Add() { var db = ObjectProvider.MakeDbInstance(); Email anEmail = ObjectProvider.MakeEmailInstance(); Console.Write("Enter email address: "); anEmail.ContactTitle = Console.ReadLine(); Console.Write("Enter the id of belonging phonebook: "); anEmail.PhonebookId = int.Parse(Console.ReadLine()); db.Add(anEmail); db.SaveChanges(); return(anEmail.Id); }