/// <summary>
        /// Return all server channels
        /// </summary>
        /// <param name="getTemporary">Include temporary channels</param>
        /// <param name="getAcl">Return acls/groups for channels</param>
        /// <param name="getInherited">Include inherited acls/groups</param>
        /// <param name="cache"></param>
        /// <returns>null - if server is not running</returns>
        public SerializableDictionary <int, VirtualServerEntity.Channel> GetAllChannels(bool getTemporary = false, bool getAcl = true, bool getInherited = true, bool cache = false)
        {
            // server must be running (getChannels() doesn's work)
            if (!IsRunning())
            {
                return(null);
            }

            // update cache
            if (!cache || _isNewChannels)
            {
                _isNewChannels = false;

                // clear
                _entity.Channels.Clear();

                // add
                foreach (var c in _server.getChannels())
                {
                    // ignore temporary channels
                    if (c.Value.temporary && !getTemporary)
                    {
                        continue;
                    }


                    var channel = getChannel(c.Value);

                    Group[] groups;
                    ACL[]   acls;
                    bool    inherit;
                    if (getAcl)
                    {
                        _server.getACL(c.Value.id, out acls, out groups, out inherit);

                        channel.InheritAcl = inherit;

                        // -- GROUPS
                        int cg = 0;
                        foreach (var @g in groups)
                        {
                            // ignore inherited groups
                            if (!getInherited && @g.inherited)
                            {
                                continue;
                            }

                            channel.Groups.Add(cg, new VirtualServerEntity.Channel.Group()
                            {
                                Name        = @g.name,
                                Inherit     = @g.inherit,
                                Inheritable = @g.inheritable,
                                Inherited   = @g.inherited,

                                Members = @g.members,
                                Add     = @g.add,
                                Remove  = @g.remove,
                            });
                            cg++;
                        }

                        // -- ACLS
                        int ca = 0;
                        foreach (var @a in acls)
                        {
                            // ignore inherited acls
                            if (!getInherited && @a.inherited)
                            {
                                continue;
                            }

                            channel.Acls.Add(ca, new VirtualServerEntity.Channel.Acl()
                            {
                                Allow     = @a.allow,
                                ApplyHere = @a.applyHere,
                                ApplySubs = @a.applySubs,
                                Deny      = @a.deny,
                                Inherited = @a.inherited,
                                Group     = @a.group,
                                UserId    = @a.userid,
                            });
                            ca++;
                        }
                    }


                    _entity.Channels.Add(c.Value.id, channel);
                }
            }
            return(_entity.Channels);
        }