func clientPosition() int32 {
	details, errDb := dbMongo.GetClientDetails()
	if errDb != nil {
		log.Error(errDb)
	}
	var maxClientPosition int32
	if len(details) == 0 {
		return 0
	}
	for _, client := range details {
		if client.ClientPosition > maxClientPosition {
			maxClientPosition = client.ClientPosition
		}
	}
	return maxClientPosition + 1
}
read client details and get client position
package main
import (
	"bufio"
	"context"
	"encoding/hex"
	"fmt"
	"os"
	"mainstay/config"
	"mainstay/db"
	"mainstay/log"
	"mainstay/models"
	"github.com/btcsuite/btcd/btcec"
	"github.com/satori/go.uuid"
)
const ConfPath = "/src/mainstay/cmd/clientsignuptool/conf.json"
var (
	mainConfig *config.Config
	dbMongo    *db.DbMongo
)
func init() {
	confFile, confErr := config.GetConfFile(os.Getenv("GOPATH") + ConfPath)
	if confErr != nil {
		log.Error(confErr)
	}
	var mainConfigErr error
	mainConfig, mainConfigErr = config.NewConfig(confFile)
	if mainConfigErr != nil {
		log.Error(mainConfigErr)
	}
}
func printClientDetails() {
	log.Infoln("existing clients")
	details, errDb := dbMongo.GetClientDetails()
	if errDb != nil {
		log.Error(errDb)
	}
	if len(details) == 0 {
		log.Infoln("no existing client positions")
		return
	}
	for _, client := range details {
		log.Infof("client_position: %d pubkey: %s name: %s\n",
			client.ClientPosition, client.Pubkey, client.ClientName)
	}
	log.Infoln()
}