public TextSecureContent(TextSecureSyncMessage synchronizeMessage)
 {
     this.message = May<TextSecureDataMessage>.NoValue;
     this.synchronizeMessage = synchronizeMessage == null ? May<TextSecureSyncMessage>.NoValue : new May<TextSecureSyncMessage>(synchronizeMessage);
 }
        public void sendMessage(TextSecureSyncMessage message)
        {
            byte[] content;

            if (message.getContacts().HasValue)
            {
                content = createMultiDeviceContactsContent(message.getContacts().ForceGetValue().asStream());
            }
            else if (message.getGroups().HasValue)
            {
                content = createMultiDeviceGroupsContent(message.getGroups().ForceGetValue().asStream());
            }
            else
            {
                throw new Exception("Unsupported sync message!");
            }

            sendMessage(localAddress, KeyHelper.getTime(), content, false);
        }