/// <summary>
        ///
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        private OperationResult <PermissionRules> GetPermissions(EntityDashboard entity)
        {
            if (null == entity)
            {
                return(OperationResult <PermissionRules> .Create(ErrorCode.BadGetDashboard));
            }

            var perms = new PermissionRules();

            var nat = entity
                      .Permissions
                      .Select(x => x
                              .ToModel()
                              .AddTime(DataContext.Entry(entity)))
                      .ToList();

            var parent = entity
                         .Folder?
                         .Permissions
                         .Select(x => x
                                 .ToModel()
                                 .AddTime(DataContext.Entry(entity.Folder)))
                         .ToList() ?? new List <ModelFolderPermission>();

            if (null != entity.Folder && !entity.Folder.HasAcl)
            {
                parent.AddRange(ModelFolderPermission.GetDefault(entity.Folder.ToModel()));
            }

            if (null == entity.Folder && !entity.HasAcl)
            {
                nat.AddRange(ModelDashboardPermission.GetDefault(entity.ToModel()));
            }

            perms.AddRange(parent);
            perms.AddRange(nat);

            return(OperationResult <PermissionRules> .Create(perms));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="f"></param>
        /// <returns></returns>
        private object ToGetPermissionsReply(ModelDashboardPermission p)
        {
            return(new
            {
                p.Id,
                p.Dashboard.Title,
                p.Dashboard.Uid,

                UserId = p.User?.Id,
                UserLogin = p.User?.Login,
                UserEmail = p.User?.Email,

                TeamId = p.Team?.Id,
                Team = p.Team?.Name,

                p.Role,

                p.Permission,
                PermissionName = p.Permission.ToString(),

                p.Bag.Created,
                p.Bag.Updated
            });
        }