/// <summary>
        /// Method saves the groups into the storage.
        /// </summary>
        /// <param name="key">Specifies a key to store.</param>
        /// <param name="groups">Specifies a groups object.</param>
        private static void SaveGroups(string key, Groups groups)
        {
            // If the groups is null, remove the entry.
            if (groups == null)
            {
                RelayStorage.RemoveKey(key);
                return;
            }

            List<string> groupItems = new List<string>();
            foreach (Group group in groups)
            {
                groupItems.Add(
                    string.Format(
                    "{0}{1}{2}{3}{4}",
                    group.Name,
                    RelayStorage.ValueSeperator,
                    group.RegistrationId,
                    RelayStorage.ValueSeperator,
                    group.SecretKey));
            }

            string groupsValue = string.Join(RelayStorage.ObjectSeperator, groupItems.ToArray());

            RelayStorage.SetValue(key, groupsValue);
        }
        /// <summary>
        /// Method reads groups from storage.
        /// </summary>
        /// <param name="key">Specifies a key to read.</param>
        /// <returns>A Groups object.</returns>
        private static Groups ReadGroups(string key)
        {
            Groups groups = new Groups();

            string value = RelayStorage.GetValue(key);
            if (string.IsNullOrEmpty(value))
            {
                return groups;
            }

            string[] groupsItems = value.Split(
                new string[] { RelayStorage.ObjectSeperator },
                System.StringSplitOptions.RemoveEmptyEntries);

            if (groupsItems == null || groupsItems.Length == 0)
            {
                return groups;
            }

            foreach (string item in groupsItems)
            {
                string[] groupItems = item.Split(
                    new string[] { RelayStorage.ValueSeperator },
                    System.StringSplitOptions.None);

                if (groupItems == null || groupItems.Length != 3)
                {
                    continue;
                }

                Group group = new Group()
                {
                    Name = groupItems[0],
                    RegistrationId = groupItems[1],
                    SecretKey = groupItems[2]
                };

                groups.Add(group);
            }

            return groups;
        }
 /// <summary>
 /// Method to read groups.
 /// </summary>
 /// <param name="groups">Specifies a groups object.</param>
 public static void SaveGroups(Groups groups)
 {
     RelayStorage.SaveGroups(RelayStorage.CreatedGroupsKey, groups);
 }