/// <summary>
        /// Refreshes the current users roles & permissions
        /// </summary>
        private static void RefreshUserRoles()
        {
            CurrentUser      = Enjin.GetUser(CurrentUser.id);
            _userPermissions = new List <string>();
            _userRoles       = new Dictionary <string, List <string> >();

            for (int i = 0; i < CurrentUser.roles.Length; i++)
            {
                string roleName = CurrentUser.roles[i].name.ToUpper();
                roleName = roleName.Replace(" ", "_"); // converts PLATFORM OWNER to
                List <string> permissions = new List <string>();

                for (int n = 0; n < CurrentUser.roles[i].permissions.Length; n++)
                {
                    if (!permissions.Contains(CurrentUser.roles[i].permissions[n].name))
                    {
                        permissions.Add(CurrentUser.roles[i].permissions[n].name);
                    }

                    if (!_userPermissions.Contains(CurrentUser.roles[i].permissions[n].name))
                    {
                        _userPermissions.Add(CurrentUser.roles[i].permissions[n].name);
                    }
                }

                if (_userRoles.ContainsKey(roleName))
                {
                    _userRoles.Remove(roleName);
                }

                _userRoles.Add(roleName, permissions);
            }
        }
        /// <summary>
        /// Creates a list of all apps team member has access to
        /// </summary>
        /// <param name="identities">Current team members identity</param>
        private static void RefreshAppList()
        {
            AppList = new List <AppSelectorData>(Enjin.GetAppsByUserID(CurrentUser.id));

            if (AppList.Count == 0)
            {
                Enjin.AppID = -1;
                return;
            }

            AppsNameList = new List <string>();

            foreach (AppSelectorData app in AppList)
            {
                AppsNameList.Add(app.appName);
            }

            Enjin.AppID         = AppList[SelectedAppIndex].appID;
            CurrentUserIdentity = Enjin.GetIdentity(AppList[SelectedAppIndex].identityID);
            CurrentUser         = Enjin.GetUser(CurrentUser.id);

            if (CurrentUserIdentity == null || CurrentUserIdentity.id == 0)
            {
                for (int i = 0; i < CurrentUser.identities.Length; i++)
                {
                    if (CurrentUser.identities[i].app_id == Enjin.AppID)
                    {
                        CurrentUserIdentity = CurrentUser.identities[i];
                    }
                }
            }
        }