anchor.diff:              owin.Request.Accept.Substring(0, owin.Request.Accept.IndexOf(","))
           else owin.Request.Accept
       
  -    /// Write http response
  +    /// Write HTTP response
       let WriteResponse (statusCode : System.Net.HttpStatusCode) (response : obj) (owin : IOwinContext) = 
  -        let matchType format res = 
  -            match format with
  -            | "text/json" | "application/json" | "json" -> 
  -                owin.Response.ContentType <- "text/json"
  -                match owin.Request.Query.Get("callback") with
  -                | null -> 
  -                    let result = JsonConvert.SerializeObject(res, jsonSettings)
  -                    Some(Encoding.UTF8.GetBytes(result))
  -                | fname -> 
  -                    let result = sprintf "%s(%s);" fname (JsonConvert.SerializeObject(res, jsonSettings))
  -                    Some(Encoding.UTF8.GetBytes(result))
  -            | "application/x-protobuf" | "application/octet-stream" | "proto" -> 
  -                owin.Response.ContentType <- "application/x-protobuf"
  -                Some(ProtoSerialize(res))
  -            | _ -> None
           owin.Response.StatusCode <- int statusCode
           if response <> Unchecked.defaultof<_> then 
               let format = GetResponseFormat owin
  -            let result = matchType format response
  -            match result with
  -            | None -> owin.Response.StatusCode <- int HttpStatusCode.InternalServerError
  -            | Some(x) -> await (owin.Response.WriteAsync(x))
  +            match Formatters.TryGetValue(format) with
  +            | true, formatter -> formatter.Serialize(response, owin.Response.Body)
  +            | _ -> owin.Response.StatusCode <- int HttpStatusCode.InternalServerError
       
       let inline IsNull(x) = obj.ReferenceEquals(x, Unchecked.defaultof<_>)
       
  -    /// Write http response
  +    /// Write HTTP response
       let GetRequestBody<'T>(request : IOwinRequest) = 
           let contentType = GetRequestFormat request
           if request.Body.CanRead then 
  -            match contentType with
  -            | "text/json" | "application/json" | "application/json; charset=utf-8" | "application/json;charset=utf-8" | "json" -> 
  -                let body = 
  -                    use reader = new System.IO.StreamReader(request.Body)
  -                    reader.ReadToEnd()
  -                if String.IsNullOrWhiteSpace(body) <> true then 
  -                    try 
  -                        let result = JsonConvert.DeserializeObject<'T>(body)
  -                        if IsNull result then 
  -                            Choice2Of2(Errors.HTTP_UNABLE_TO_PARSE
  -                                       |> GenerateOperationMessage
  -                                       |> Append("Message", "No body is defined."))
  -                        else Choice1Of2(result)
  -                    with ex -> 
  +            match Formatters.TryGetValue(contentType) with
  +            | true, formatter -> 
  +                try 
  +                    let result = formatter.DeSerialize<'T>(request.Body)
  +                    if IsNull result then 
                           Choice2Of2(Errors.HTTP_UNABLE_TO_PARSE
                                      |> GenerateOperationMessage
  -                                   |> Append("Message", ex.Message))
  -                else Choice2Of2(Errors.HTTP_NO_BODY_DEFINED |> GenerateOperationMessage)
  -            | "application/x-protobuf" | "application/octet-stream" | "proto" -> 
  -                try 
  -                    Choice1Of2(ProtoBuf.Serializer.Deserialize<'T>(request.Body))
  +                                   |> Append("Message", "No body is defined."))
  +                    else Choice1Of2(result)
                   with ex -> 
                       Choice2Of2(Errors.HTTP_UNABLE_TO_PARSE
                                  |> GenerateOperationMessage
  
positive.code:             | _ -> Choice2Of2(Errors.HTTP_UNSUPPORTED_CONTENT_TYPE |> GenerateOperationMessage)
          else Choice2Of2(Errors.HTTP_NO_BODY_DEFINED |> GenerateOperationMessage)
      
      let CREATED (value : obj) (owin : IOwinContext) = WriteResponse HttpStatusCode.Created value owin
      let ACCEPTED (value : obj) (owin : IOwinContext) = WriteResponse HttpStatusCode.Accepted value owin
      let OK (value : obj) (owin : IOwinContext) = WriteResponse HttpStatusCode.OK value owin
  
negative.code: module HttpHelpers = 
      open FlexSearch
      open FlexSearch.Api
      open FlexSearch.Api.Messages
      open FlexSearch.Core
      open FlexSearch.Utility
      open Microsoft.Owin
  