// Displays a collection of errors, separated by newlines.
        public static void DisplayErrors(this UIViewController self, IEnumerable <NSError> errors)
        {
            var messages = new List <string> ();

            foreach (var error in errors)
            {
                var errorCode = (HMError)(int)error.Code;
                if (self.PresentedViewController != null || errorCode == HMError.OperationCancelled || errorCode == HMError.UserDeclinedAddingUser)
                {
                    Console.WriteLine(error.LocalizedDescription);
                }
                else
                {
                    messages.Add(error.LocalizedDescription);
                }
            }

            if (messages.Count > 0)
            {
                // There were errors in the list, reduce the messages into a single one.
                string collectedMessage = string.Join("\n", messages);
                self.DisplayErrorMessage(collectedMessage);
            }
        }