private static Profile BuildProfile(string name)
        {
            var _reg = new RegistryEditor(false);

              _reg.ProfileName = name; //todo this is bad, make this thread-safe
              return new Profile
              {
            Directory = _reg.Read(Directory),
            Name = _reg.Read(Name),
            Order = _reg.ReadInt(Order) ?? 0,
              };
        }
        public static void Save(IList<Profile> profiles)
        {
            var reg = new RegistryEditor(false);
              reg.DeleteSubKeyTree();

              var order = 0;

              foreach (var profile in profiles)
              {
            reg.ProfileName = profile.Name;  //todo this is bad, make this thread-safe
            reg.Write(Name, profile.Name);
            reg.Write(Directory, profile.Directory);
            reg.Write(Order, order++);
              }
        }
        public static IList<Profile> Load()
        {
            var profiles = new List<Profile>();

              var reg = new RegistryEditor(false);
              try
              {
            foreach (var name in reg.ReadKeys())
            {
              profiles.Add(BuildProfile(name));
            }
              }
              catch (Exception)
              {
            return new List<Profile>();
              }

              return profiles.OrderBy(x => x.Order).ToList();
        }