private void PlayMessage(MessageDB message)
        {
            voiceFiles.Clear ();
            contentPackItems.Clear ();
            pollSteps.Clear ();

            MessageInfo messageInfo = this.MessageItems [message.MessageID];

            ContentState dlState = new ContentState (message);
            contentPackItems = getLocalContentPackItems (dlState.ContentPackIDQ.ToList ())
                .ToDictionary (s => s.ContentPackItemID, s => ContentPackItemDB.ConvertFromContentPackItemDB (s));

            if (messageInfo.HasContentInfo) {
                RunOnUiThread (delegate {
                    if (progress != null)
                        progress.Dismiss ();
                    this.PlayUnsentMessage (messageInfo.ContentInfo);
                });
            } else {
                Dictionary<Guid, Dictionary<int, string>> localVoiceFiles =
                    getLocalVoiceFiles (new List<Pair<Guid, List<int>>> () { new Pair<Guid, List<int>>(dlState.Message.MessageID, dlState.VoiceIDQ.ToList()) });

                if (!localVoiceFiles.TryGetValue (dlState.Message.MessageID, out voiceFiles))
                    voiceFiles = new Dictionary<int, string> ();

                pollSteps = getLocalPollingStepsForMessage (dlState.Message.MessageGuid)
                    .ToDictionary (s => s.StepNumber, s => PollingStepDB.ConvertFromPollingStepDB (s));

                dlState.RemoveExistingItems (contentPackItems.Keys.ToList (), voiceFiles.Keys.ToList (), pollSteps.Keys.ToList ());
                if (dlState.HasContentForDownload) {
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine ("dlState has content for download");
            #endif
                    if (dlState.HasContentPackItems) {
            #if DEBUG
                        System.Diagnostics.Debug.WriteLine ("dlState has contentpackitems for download");
            #endif
                        LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint);
                        service.ContentPackGetItemCompleted += Service_ContentPackGetItemCompleted;
                        service.ContentPackGetItemAsync (dlState.ContentPackIDQ.Peek (), ContentPackItem.ItemSize.Small, AndroidData.CurrentUser.AccountID,
                            new Guid (AndroidData.ServiceAuthToken), dlState);
                    } else
                        if (dlState.HasVoiceRecordings) {
            #if DEBUG
                        System.Diagnostics.Debug.WriteLine ("dlState has voicerecordings for download");
            #endif
                        LOLMessageClient service = new LOLMessageClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint);
                        service.MessageGetStepDataCompleted += Service_MessageGetStepData;
                        service.MessageGetStepDataAsync (dlState.Message.MessageID, dlState.VoiceIDQ.Peek (), new Guid (AndroidData.ServiceAuthToken), dlState);
                    } else
                            if (dlState.HasPollingSteps) {
                        RunOnUiThread (delegate {
            #if DEBUG
                            System.Diagnostics.Debug.WriteLine ("dlState has pollingsteps for download");
            #endif
                            LOLMessageClient service = new LOLMessageClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint);
                            service.PollingStepGetCompleted += Service_PollingStepGetCompleted;
                            service.PollingStepGetAsync (dlState.Message.MessageID, dlState.PollingIDQ.Peek (), AndroidData.CurrentUser.AccountID,
                                        new Guid (AndroidData.ServiceAuthToken), dlState);
                        });
                    }
                } else
                    RunOnUiThread (delegate {
                        StartPlayMessage (message);
                    });
            }
        }
        private void Service_ContentPackGetItemCompleted(object sender, ContentPackGetItemCompletedEventArgs e)
        {
            LOLConnectClient service = (LOLConnectClient)sender;

            if (null == e.Error) {
                ContentPackItem result = e.Result;

                if (result.Errors.Count > 0) {
            #if(DEBUG)
                    System.Diagnostics.Debug.WriteLine ("Error in getting content pack items! {0}", StringUtils.CreateErrorMessageFromGeneralErrors (result.Errors.ToArray ()));
            #endif
                } else {
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine ("Content pack. Result = {0}", result);
            #endif
                    this.contentPackItems [result.ContentPackItemID] = result;
                    ContentPackItemDB contentPackItem = ContentPackItemDB.ConvertFromContentPackItem (result);
                    RunOnUiThread (delegate {
                        SaveContentPackItem (contentPackItem);
                        dbm.InsertOrUpdateContentPackItems (new List<ContentPackItemDB> () { contentPackItem });
                    });
                }//end if else

                ContentState stateObj = (ContentState)e.UserState;
                stateObj.ContentPackIDQ.Dequeue ();

                if (stateObj.HasContentPackItems) {
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine ("Contentpack get item completed async");
            #endif

                    service.ContentPackGetItemAsync (stateObj.ContentPackIDQ.Peek (),
                                                     ContentPackItem.ItemSize.Small,
                                                     AndroidData.CurrentUser.AccountID,
                                                     new Guid (AndroidData.ServiceAuthToken), stateObj);
                } else
                if (stateObj.HasVoiceRecordings) {
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine ("Contentpack get item completed - has voice recordings");
            #endif
                    service.ContentPackGetItemCompleted -= Service_ContentPackGetItemCompleted;

                    LOLMessageClient msgService = new LOLMessageClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint);
                    msgService.MessageGetStepDataCompleted += Service_MessageGetStepData;
                    msgService.MessageGetStepDataAsync (stateObj.Message.MessageID, stateObj.VoiceIDQ.Peek (), new Guid (AndroidData.ServiceAuthToken), stateObj);
                } else
                if (stateObj.HasPollingSteps) {
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine ("Contentpack get item completed - has poll steps");
            #endif
                    service.ContentPackGetItemCompleted -= Service_ContentPackGetItemCompleted;

                    LOLMessageClient msgService = new LOLMessageClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLMessageEndpoint);
                    msgService.PollingStepGetCompleted += Service_PollingStepGetCompleted;
                    msgService.PollingStepGetAsync (stateObj.Message.MessageID,
                                                    stateObj.PollingIDQ.Peek (),
                                                    AndroidData.CurrentUser.AccountID,
                                                    new Guid (AndroidData.ServiceAuthToken), stateObj);
                } else {
            #if DEBUG
                    System.Diagnostics.Debug.WriteLine ("Contentpack get item completed - startplaymessage");
            #endif
                    service.ContentPackGetItemCompleted -= Service_ContentPackGetItemCompleted;
                    RunOnUiThread (delegate {
                        StartPlayMessage (stateObj.Message);
                    });
                }//end if else
            } else {
            #if(DEBUG)
                System.Diagnostics.Debug.WriteLine ("Exception in getting content pack items! {0}--{1}", e.Error.Message, e.Error.StackTrace);
            #endif
            }//end if else
        }