public ContactGroup Save(ContactGroup contact) { Contract.Requires <ArgumentNullException>(null != contact); Contract.Requires <ArgumentNullException>(null != contact.Owner); Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != contact.Identifier); Contract.Requires <ArgumentOutOfRangeException>(Guid.Empty != contact.Owner.Identifier); using (new PerformanceMonitor()) { var row = contact.Convert(); var table = new AzureTable <ContactGroupRow>(ServerConfiguration.Default, new ContactGroupRowValidator()); var data = table.QueryBy(row.PartitionKey, row.RowKey); if (null == data) { table.AddEntity(row); } else { data.Name = row.Name; table.AddOrUpdateEntity(data); row = data; } return(row.Convert()); } }