/**
   * Transforms JCR {@code Node} into {@code Profession} object
   *
   * @param node JCR {@code Node}
   * @return {@code Profession} object
   */
  public static Profession nodeToProfession(Node node) {
    if (node == null) {
      throw new IllegalArgumentException("Node is null");
    }

    Profession profession = null;
    try {
      profession = new Profession();
      profession.setUuid(node.getIdentifier());
      profession.setName(node.getProperty(PROP_NAME.toString()).getString());
    } catch (RepositoryException ex) {
      logger.error("Failed to transform JCR Node to Profession. " + ex.getMessage());
    }

    return profession;
  }
  /**
   * Transforms JCR {@code Node} into {@code UserDTO} object
   *
   * @param node JCR {@code Node}
   * @return {@code UserDTO} object
   */
  public static UserDTO nodeToUserDTO(Node node) {
    if (node == null) {
      throw new IllegalArgumentException("Node is null");
    }

    UserDTO user = null;
    try {
      user = new UserDTO();
      user.setUuid(node.getIdentifier());
      user.setName(node.getProperty(PROP_NAME.toString()).getString());
      user.setProfession(
          nodeToProfession(
              node.getSession()
                  .getNodeByIdentifier(node.getProperty(PROP_PROFESSION.toString()).getString())));

    } catch (RepositoryException ex) {
      logger.error("Failed to transform JCR Node to UserDTO. " + ex.getMessage());
    }

    return user;
  }
  /**
   * Transforms JCR {@code Node} into {@code User} object
   *
   * @param node JCR {@code Node}
   * @return {@code User} object
   */
  public static User nodeToUser(Node node) {
    if (node == null) {
      throw new IllegalArgumentException("Node is null");
    }

    User user = null;
    try {
      user = new User();
      user.setUuid(node.getIdentifier());
      user.setPassword(node.getProperty(PROP_PASSWORD.toString()).getString());
      user.setEmail(node.getProperty(PROP_EMAIL.toString()).getString());
      user.setName(node.getProperty(PROP_NAME.toString()).getString());
      user.setPrivileged(node.getProperty(PROP_PRIVILEGED.toString()).getBoolean());
      user.setProfession(
          nodeToProfession(
              node.getSession()
                  .getNodeByIdentifier(node.getProperty(PROP_PROFESSION.toString()).getString())));
    } catch (RepositoryException ex) {
      logger.error("Failed to transform JCR Node to User. " + ex.getMessage());
    }

    return user;
  }