/**
  * This method executes the update user details query in the azure SQL database for the input user
  * entity.
  */
 @Override
 public UserEntity updateNewUser(UserEntity user) throws Exception {
   LOGGER.info("[UserDAOImpl][updateNewUser] start ");
   Connection connection = null;
   PreparedStatement preparedStatement = null;
   ResultSet resultSet = null;
   try {
     connection = AzureChatUtils.getConnection(AzureChatUtils.buildConnectionString());
     preparedStatement = connection.prepareStatement(AzureChatSQLConstants.UPDATE_NEW_USER);
     preparedStatement.setString(1, user.getFirstName());
     preparedStatement.setString(2, user.getLastName());
     preparedStatement.setString(3, user.getPhotoBlobUrl());
     preparedStatement.setString(4, user.getEmailAddress());
     preparedStatement.setInt(5, user.getPhoneCountryCode());
     preparedStatement.setLong(6, user.getPhoneNumber());
     preparedStatement.setString(7, user.getNameId());
     preparedStatement.executeUpdate();
   } catch (Exception e) {
     LOGGER.error(
         "Exception occurred while executing update user query on the azure SQL table. Exception Message : "
             + e.getMessage());
     throw new AzureChatSystemException(
         "Exception occurred while executing update user query on the azure SQL table. Exception Message : "
             + e.getMessage());
   } finally {
     AzureChatUtils.closeDatabaseResources(preparedStatement, resultSet, connection);
   }
   LOGGER.info("[UserDAOImpl][updateNewUser] end ");
   return user;
 }
 /**
  * This method generates the prepare statement from userEntity object.
  *
  * @param preparedStatement
  * @param user
  * @return
  * @throws SQLException
  */
 public PreparedStatement generatePreparedStatement(
     PreparedStatement preparedStatement, UserEntity user) throws SQLException {
   preparedStatement.setString(1, user.getNameId());
   preparedStatement.setString(2, user.getIdentityProvider());
   preparedStatement.setString(3, user.getFirstName());
   preparedStatement.setString(4, user.getLastName());
   preparedStatement.setString(5, user.getPhotoBlobUrl());
   preparedStatement.setString(6, user.getEmailAddress());
   preparedStatement.setInt(7, user.getPhoneCountryCode());
   preparedStatement.setLong(8, user.getPhoneNumber());
   preparedStatement.setDate(9, new java.sql.Date(user.getDateCreated().getTime()));
   preparedStatement.setDate(10, new java.sql.Date(user.getCreatedBy().getTime()));
   preparedStatement.setDate(11, new java.sql.Date(user.getDateModified().getTime()));
   preparedStatement.setDate(12, new java.sql.Date(user.getModifiedBy().getTime()));
   return preparedStatement;
 }