public void SaveOrUpdate(CloudUpdate updateData) { bool cloudAdded = false; Cloud cloud; if (false == clouds.TryGetValue(updateData.ID, out cloud)) { cloud = new Cloud(updateData.ID); clouds[cloud.ID] = cloud; cloudAdded = true; } cloud.ServerName = updateData.ServerName; cloud.Url = updateData.ServerUrl; cloud.Email = updateData.Email; cloud.Password = updateData.Password; if (cloudAdded) { OnCloudAdded(cloud); } else { OnCloudChanged(cloud); } }