public UUID save(Ticket obj) throws SQLException {
        UUID id = null;
        Connection conn = null;
        CallableStatement stmt = null;

        try {
            conn = getConnection();

            String query = "{call spr_saveTicket( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )} ";

            // Get a statement from the connection
            stmt = conn.prepareCall(query);

            String tmpId = null;

            if( obj.getTicketId() != null ) {
                tmpId = obj.getTicketId().toString();
            }

            String tmpUserIdEdit = null;
            if( obj.getUserIdEdit() != null ) {
                tmpUserIdEdit = obj.getUserIdEdit().toString();
            }

            Date tmpCreationDate = new Date(Calendar.getInstance().getTimeInMillis());
            if (obj.getCreationDate() != null) {
                tmpCreationDate = new Date(obj.getCreationDate().getTime());
            }

            Date tmpTargetDate = null;
            if (obj.getTargetDate() != null) {
                tmpTargetDate = new Date( obj.getTargetDate().getTime() );
            }

            int i = 1;
            stmt.setString(i++, tmpId);
            stmt.setString(i++, obj.getTitle());
            stmt.setDate(i++, tmpTargetDate);
            stmt.setDate(i++, tmpCreationDate);
            stmt.setString(i++, obj.getContactFirstname());
            stmt.setString(i++, obj.getContactLastname());
            stmt.setString(i++, obj.getContactEmail());
            stmt.setString(i++, obj.getContactPhone());
            stmt.setInt(i++, obj.getWorkingTime());
            stmt.setBoolean(i++, obj.isContactByPhone());
            stmt.setBoolean(i++, obj.isContactByEmail());
            stmt.setString(i++, obj.getPriorityId().toString());
            stmt.setString(i++, obj.getCategoryId().toString());
            stmt.setString(i++, obj.getStateId().toString());
            stmt.setString(i++, tmpUserIdEdit);
            stmt.setString(i++, obj.getUserIdCreate().toString());
            stmt.setString(i++, obj.getRelatedPersonId().toString());
            stmt.setString(i++, obj.getRelatedRegionId().toString());
            stmt.registerOutParameter(i, Types.NVARCHAR);

            // Execute the query
            stmt.execute();

            String savedId = stmt.getString("savedId");

            if (savedId != null) {
                id = UUID.fromString(savedId);

                obj.setTicketId(id);
            }
        }
        catch (SQLException ex) {
            LOGGER.error(ex.getMessage());

            throw new SQLException(ex);
        }
        finally {
            if (stmt != null) {
                stmt.close();
            }

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

        return id;
    }