// -------------------------------------------
    //  PRIVATE
    // -------------------------------------------

    private void UpdateProfile(string device, string key, object value) {
      lock (Profiles) {
        // 1. Seek for profile identifed by master key
        foreach (var p in Profiles) {
          if (p.Is(key, value)) {
            AddProfile(p, device);
            return;
          }
        }

        // 2. Seek for last know profile on device
        if (Devices.ContainsKey(device)) {
          var tracker = Devices[device];

          // 2.1 Latest profile has less than 10 minutes
          if (!tracker.IsDeprecated()) {
            tracker.Profile.Update(key, value);
            tracker.Update = DateTime.Now;
            return;
          }
        }

        // 3. Setup new Profile
        var profile = new Profile(key, value);
        AddProfile(profile, device);
      }
    }
    private void AddProfile(Profile profile, string device) { 

      // Clean old tracker
      if (Devices.ContainsKey(device)) {
        var t = Devices[device];
        if (t.IsDeprecated()) {
          Profiles.Remove(t.Profile);
        }

        t.Profile = profile;
        t.Update = DateTime.Now;
      }

      // Add new Tracker
      else {
        Devices[device] = new Tracker(profile);
      }

      // Add to profile list
      if (!Profiles.Contains(profile))
        Profiles.Add(profile);
    }
 public Tracker(Profile p) {
   Profile = p;
   Update = DateTime.Now;
 }