anchor.diff:                      command.CommandType <- Data.CommandType.StoredProcedure
                       let mv = command.Parameters.AddWithValue ("@movie", "")
                       let uc = command.Parameters.AddWithValue ("@usercount", 0)
  -                    stats 
  -                        |> map_ (fun (m, u) ->
  -                            mv.Value <- m
  -                            uc.Value <- u
  -                            command.ExecuteNonQuery() |> ignore)
  -                with exn -> log Error "DB-Execution failed: %A" exn
  -            | _   -> ()
  +                    state.Users |> groupBy (fun {Movie = m} -> m.ToLowerInvariant()) |>> map length |> map_ (fun (m, u) ->
  +                                mv.Value <- m
  +                                uc.Value <- u
  +                                command.ExecuteNonQuery() |> ignore)
  +                with exn -> log Error "DB-Execution failed: %A" exn) <!> appServer.dbCnString <*> appServer.spStats |> ignore
               let qs = state.CurrentQueueLength
               log (if qs > 1000 then Fatal elif qs > 100 then Error elif qs > 10 then Warn else Trace) "Queue size is %i" qs
               log Debug "Users   : %i" (length state.Users)
  
positive.code:                 if not (session.SocketSession.TrySend (ArraySegment bytes)) then
                      log Warn "Dropping Message to session: %s from %-15s , size was %-4i (sender = %s, rcpts = %A, subject = %s)." session.SessionID (ipAddress session) (length bytes) message.sender message.recipients message.subject
  
  
          let processDBCommand (session:CustomProtocolSession) plist =
              match appServer.dbCnString with
              | None   -> log Warn "execDbQuery received but no connection string specified: %A" plist
              | Some s ->
                  let execDbQuery sp_name sp_args =
                      log Trace "execDbQuery %s %s" sp_name sp_args
                      use conn = new SqlConnection (s)
                      conn.Open()
                      let query = "exec sp_" + sp_name + " " + sp_args
                      use command = new SqlCommand (query, conn)
                      let lst = seq {
                          use reader = command.ExecuteReader()
                          while reader.Read() do
                              yield [0.. reader.FieldCount-1] |>> fun i -> 
                                  if reader.GetFieldType i = typeof<Boolean> then if reader.GetBoolean i then "1" else "0" 
                                  else reader.[i].ToString()} |> toList
                      log Trace "DB-Execution results: %A" lst
                      lst
                  
                  let dct = dict plist
                  match dct.TryGetValue appServer.dbFnName, dct.TryGetValue appServer.dbFnArgs with
                  | (true, LString fn), (true, LList args) ->
                      log Trace "Msg Content is : %A" plist
                      let strArgs = String.concat "," (args |>> function 
                          | LString  e -> "'" + e.Replace ("'","''") + "'" 
                          | LInteger e -> "'" + string e + "'" 
                          | LVoid -> "'" + "<Void>" + "'"
                          | s -> failwith (sprintf "Unexpected DBExec message format received: %A" s))
                      let lstResult = execDbQuery fn strArgs
                      let result = toList plist @ [appServer.dbFnResult, lstResult |>> (map LString >> LList) |> LList]
                      log Trace "Result before sending to server: %A" (LPropList result)
  
                      let msg = writeMessage ("System", state.Users |> filter (fun {Session = s} -> s == session.SessionID) |>> (fun {Name = n} -> n), "DBexec", LPropList result |> pickle valueP)
                      session |> send msg
  
                  | _ -> log Error "Wrong DBExec message content format: %A ." dct
  
  
          let processAdminCommand session cmd plist =
              let nl = Environment.NewLine
              let reply str = session |> send (writeMessage ("System", (state.Users |> filter (fun {Session = s} -> s == session.SessionID) |>> fun {Name = n} -> n), "Admin Command Reply", pickle valueP (LString str)))
              try
                  match cmd with
                  | "t" -> reply (sprintf " -> Changing minimum screen log Level to: %A" Trace); setScreenLogLevel Trace
  
negative.code:                 if not s.Authenticated && (DateTime.Now - s.StartTime).TotalSeconds > 60. then 
                      log Debug "Session %s from %s Timeout." s.SessionID (ipAddress s)
                      s.Close CloseReason.TimeOut)
  
          appServer.add_NewRequestReceived  (RequestHandler<_, _> evtRequest)
          appServer.add_NewSessionConnected (SessionHandler<_>    evtLogin  )
          appServer.add_SessionClosed       (SessionHandler<_, _> evtLogout )
          let timer = new Timers.Timer 15000.
          timer.Elapsed.Add evtStatus
          timer.Enabled <- true
                  
          base.OnStarted()