public override Task Invoke(IOwinContext context)
        {
            var path        = context.Request.Path.ToString();
            var fileContext = new StaticFileContext(context);

            if (fileContext.ValidateMethod())
            {
                var fileInfo = FindFile(path);
                if (fileInfo != null)
                {
                    var contentType = FindContentType(path);
                    fileContext.SetPayload(fileInfo, contentType);
                    fileContext.ComprehendRequestHeaders();

                    switch (fileContext.GetPreconditionState())
                    {
                    case StaticFileContext.PreconditionState.Unspecified:
                    case StaticFileContext.PreconditionState.ShouldProcess:
                        if (fileContext.IsHeadMethod)
                        {
                            return(fileContext.SendStatusAsync(Constants.Status200Ok));
                        }

                        return(fileContext.SendAsync());

                    case StaticFileContext.PreconditionState.NotModified:
                        return(fileContext.SendStatusAsync(Constants.Status304NotModified));

                    case StaticFileContext.PreconditionState.PreconditionFailed:
                        return(fileContext.SendStatusAsync(Constants.Status412PreconditionFailed));

                    default:
                        throw new NotImplementedException(fileContext.GetPreconditionState().ToString());
                    }
                }
            }

            return(Next.Invoke(context));
        }