private long persistDetails(Details details) throws SQLException {

		Connection connection = null;
		PreparedStatement preparedStatement = null;

		String insertSQL = "INSERT INTO payment_details"
				+ "(bank_BIC,bank_name,total,date_of_payment,date_of_execution) VALUES"
				+ "(?,?,?,?,?)";

		try {

			connection = provider.getConnection();
			preparedStatement = connection.prepareStatement(insertSQL,
					Statement.RETURN_GENERATED_KEYS);

			preparedStatement.setString(1, details.getBankBIC());
			preparedStatement.setString(2, details.getBankName());
			preparedStatement.setBigDecimal(3, details.getTotal());

			Date dateOfPayment = convertToSQLDate(details.getDateOfPayment());
			preparedStatement.setDate(4, dateOfPayment);

			Date dateOfExecution = convertToSQLDate(details
					.getDateOfExecution());
			preparedStatement.setDate(5, dateOfExecution);

			preparedStatement.executeUpdate();

			long lastInsertID = getLastInsertId(preparedStatement);
			return lastInsertID;

		} catch (SQLException e) {
			if (e.getSQLState().equals(IConnectionProvider.DUPLICATE_STATE)) {
				logger.warn("Duplicate entry. Keep working");
				return -1;
			} else {
				logger.error("SQL error during 'persistDetails'", e);
				throw e;

			}
		} finally {

			if (preparedStatement != null) {
				preparedStatement.close();
			}

			if (connection != null) {
				connection.close();
			}

		}

	}