         else {
             parameters["createBlogPostPage"] = true
         }
-        
+
         print("Create Post view parameters created with titleError set to \(titleError), contentsError set to \(contentsError), editing set to \(isEditing) and errors set to \(errors)")
-        
+
         return try drop.view.make("blog/admin/createPost", parameters)
     }
-    
+
     func createUserView(editing: Bool = false, errors: [String]? = nil, name: String? = nil, username: String? = nil, passwordError: Bool? = nil, confirmPasswordError: Bool? = nil, resetPasswordRequired: Bool? = nil, userId: Node? = nil) throws -> View {
         let nameError = name == nil && errors != nil
         let usernameError = username == nil && errors != nil
-        
+
         var parameters = [
             "nameError": nameError.makeNode(),
             "usernameError": usernameError.makeNode(),
             ]
-        
+
         if let createUserErrors = errors {
             parameters["errors"] = try createUserErrors.makeNode()
         }
-        
+
         if let nameSupplied = name {
             parameters["nameSupplied"] = nameSupplied.makeNode()
         }
-        
+
         if let usernameSupplied = username {
             parameters["usernameSupplied"] = usernameSupplied.makeNode()
         }
-        
+
         if let passwordError = passwordError {
             parameters["passwordError"] = passwordError.makeNode()
         }
-        
+
         if let confirmPasswordError = confirmPasswordError {
             parameters["confirmPasswordError"] = confirmPasswordError.makeNode()
         }
-        
+
         if let _ = resetPasswordRequired {
             parameters["resetPasswordOnLoginSupplied"] = true
         }
-        
+
         if editing {
             parameters["editing"] = true
             guard let userId = userId else {

import Paginator

struct LeafViewFactory: ViewFactory {
    
    let drop: Droplet
    
    // MARK: - Admin Controller Views
    
    func createBlogPostView(uri: URI, errors: [String]? = nil, title: String? = nil, contents: String? = nil, slugUrl: String? = nil, tags: String? = nil, isEditing: Bool = false, postToEdit: BlogPost? = nil) throws -> View {
        let titleError = (title == nil || (title?.isWhitespace())!) && errors != nil
        let contentsError = (contents == nil || (contents?.isWhitespace())!) && errors != nil
        
        let postPathPrefix: String
        
        if isEditing {
            guard let editSubstringIndex = uri.description.range(of: "admin/posts")?.lowerBound else {
                throw Abort.serverError

        else {
            postPathPrefix = uri.description.replacingOccurrences(of: "admin/createPost", with: "posts")
        }

        var parameters = [
            "postPathPrefix": postPathPrefix.makeNode(),
            "titleError": titleError.makeNode(),
            "contentsError": contentsError.makeNode(),
            ]

        if let createBlogErrors = errors {
            parameters["errors"] = try createBlogErrors.makeNode()
        }

        if let titleSupplied = title {
            parameters["titleSupplied"] = titleSupplied.makeNode()
        }

        if let contentsSupplied = contents {
            parameters["contentsSupplied"] = contentsSupplied.makeNode()
        }

        if let slugUrlSupplied = slugUrl {
            parameters["slugUrlSupplied"] = slugUrlSupplied.makeNode()
        }

        if let tagsSupplied = tags {
            parameters["tagsSupplied"] = tagsSupplied.makeNode()
        }

        if isEditing {
            parameters["editing"] = isEditing.makeNode()
            guard let post = postToEdit else {
