@Transactional
	public void setNotes(ArrayList<NoteModel> notes) {
		for (NoteModel noteModel : notes) {
			if (noteModel.isDeleted()) {
				session = sessionFactory.openSession();
				if (session.get(Note.class, noteModel.getId()) != null) {
					session.beginTransaction();
					NoteModel note = (NoteModel) session.get(Note.class, noteModel.getId());
					session.delete(note);
					session.getTransaction().commit();
				}
			} else if (noteModel.isChanged()) {
				noteModel.setChanged(false);
				session = sessionFactory.openSession();
				if (session.get(Note.class, noteModel.getId()) != null) {
					session.beginTransaction();
					NoteModel note = (NoteModel) session.get(Note.class, noteModel.getId());
					note.setChanged(noteModel.isChanged());
					note.setDeleted(noteModel.isDeleted());
					note.setText(noteModel.getText());
					session.getTransaction().commit();
				} else {
					session.beginTransaction();
					session.save(noteModel);
					session.getTransaction().commit();
				}
				session.close();
			}
		}
	}