 		JSON.parse note.toString()
 
 	###
+	# Update Notebook Metadata
+	# @param {String} id The notebook id
+	# @param {Object} data The new notebook data
+	# @return {Object} data The updated notebook data
+	###
+	updateNotebook: (id, data) ->
+		# Ensure that the id does not change
+		data.id = id
+
+		fs.writeFile path.join(@notebookdir, id + ".json"),
+			JSON.stringify data
+
+		return data
+
+	###
+	# Update Note Data
+	# @param {String} id The note id
+	# @param {Object} data The new note data
+	# @return {Object} data The updated note data
+	###
+	updateNote: (id, data) ->
+		# This stuff cannot be set by the user
+		data.id = id
+		data.date = Math.round(new Date() / 1000)
+
+		# If the notebook has changed, we need to rename the note
+		if data.notebook != @readNote(id).notebook
+			fs.renameSync(
+				path.join(@notebookdir, @filenameNote(id)),
+				path.join(@notebookdir, data.notebook+"."+id+".noted")
+			)
+
+		fs.writeFile path.join(@notebookdir, data.notebook+"."+id+".noted"),
+			JSON.stringify data
+
+		return data
+
+	###
 	# Deletes a notebook
 	# @param {String} id The notebook id
 	###

	###
	deleteNote: (id) ->
		fs.unlink path.join(@notebookdir, @filenameNote(id))


noteddb = new db(notebookdir())
# notebook = noteddb.createNotebook("Getting Started")
# noteddb.createNote("Awesome", "b67fe9194949bd46", "YOLO SWAGGGG")
# noteddb.deleteNotebook(noteddb.readNotebooks()[0])

fs = require 'fs'
path = require 'path'

generateUid = ->
	s4 = ->
