I have the following 2 models:
public class Alert
{
    public int Id { get; set; }
    public DateTime AlertDatetime { get; set; }
    public bool Unread { get; set; }
    public int? ReadByUserId { get; set; }
    public DateTime? ReadDateTime { get; set; }
    public DateTime ImportDateTime { get; set; }
    public bool AlertHasRecords { get; set; }
    //Error Reporting and Recording.
    public bool Error { get; set; }
    public string ErrorText { get; set; }
    public virtual IEnumerable<AlertRecord> Records { get; set; }
}
public class AlertRecord
{
    public int Id { get; set; }
    public string HospitalNumber { get; set; }
    public string ForeName { get; set; }
    public string SurName { get; set; }
    public DateTime DateOfBirth { get; set; }
    public DateTime EventDateTime { get; set; }
    public string CrisNumber { get; set; }
    public DateTime CreationDateTime { get; set; }
    //Link it back to the master Alert!
    public int AlertId { get; set; }
    public virtual Alert Alert { get; set; }
}
Once the "Alert" Object properties have values in them, I am trying to use EntityFramework to inset this object into my SQL DB like this:
class Program
{
    private static Alert MainAlert = new Alert();
    private static PrimaryDBContext db = new PrimaryDBContext();
    static void Main(string[] args)
    {
        MainAlert = AlertObjectFactory.GetAlertObject();            
        db.Alerts.Add(MainAlert);
        db.SaveChanges();
    }
}
The AlertObjectFactory.cs and The Class responsible for building the list of AlertRecords are here(They are large class files) https://gist.github.com/anonymous/67a2ae0192257ac51f39
The "Alert" Table is being populated with data, however the 4 records in the IEnumerable Records are not being inserted...
Is this functionality possible with EF?
 
     
    