public Level CreateLevel(Level level)
        {
            _Trace.TraceEvent(TraceEventType.Verbose, -1, "CreateLevel");

            CriticalResultsEntityManager manager = new CriticalResultsEntityManager();
            LevelEntity entity = manager.CreateLevel(level.Name, level.Description, level.ShortDescription, level.ColorValue, level.EscalationTimeout, level.DueTimeout, level.DirectContactRequired);
            if (level.Transports != null)
            {
                foreach(Transport t in level.Transports){
                    bool mandatory = false;
                    foreach(Transport mT in level.MandatoryTransports)
                    {
                        if(mT.Name == t.Name)
                        {
                            mandatory = true;
                        }
                    }
                    manager.CreateTransportLevelEntity(entity.Uuid, t.Name, mandatory);
                }
                UserEntity[] ues = manager.GetAllUsers();
                entity.TransportLevels.Load();
                foreach (UserEntity ue in ues)
                {
                    ue.UserTransports.Load();

                    foreach (UserTransportEntity te in ue.UserTransports)
                    {

                        foreach (TransportLevelEntity t in entity.TransportLevels)
                        {
                            if (te.Transport != null)
                            {
                                if (t.Transport.Name == te.Transport.Name)
                                {
                                    te.Levels.Add(entity);
                                }
                            }
                        }
                    }
                }
                manager.SaveChanges();
            }
            return new Level(entity);
        }
 /// <summary>
 /// Add a transport to all users
 /// Created: 2009-07-27 John Morgan
 /// </summary>
 /// <param name="transportName"></param>
 /// <returns></returns>
 private bool AddUsersToTransport(string transportName)
 {
     CriticalResultsEntityManager manager = new CriticalResultsEntityManager();
     UserEntity[] users = manager.GetAllUsers();
     foreach (UserEntity user in users)
     {
         manager.CreateUserTransport(user.UserName, transportName, "");
     }
     return true;
 }