public async Task <IActionResult> GetDuplicatePersons([FromBody] GetDuplicatePersonsCommand getDuplicatePersonsCommand)
        {
            var response = await _mediatR.Send(getDuplicatePersonsCommand, Request.HttpContext.RequestAborted);

            if (response.IsValid)
            {
                return(Ok(response.Value));
            }
            return(BadRequest(response));
        }
        public async Task <Result <List <DuplicatePersonsPoco> > > Handle(GetDuplicatePersonsCommand request, CancellationToken cancellationToken)
        {
            using (_unitOfWork)
            {
                try
                {
                    StringBuilder sql = new StringBuilder();
                    sql.Append("sp_GetPossibleDuplicates @matchFirstName, @matchMiddleName, @matchLastname, @matchSex, @matchEnrollmentNumber, @matchDOB, @matchEnrollmentDate, @matchARTStartDate, @matchHIVDiagnosisDate");

                    var matchFirstName = new SqlParameter();
                    matchFirstName.SqlDbType     = SqlDbType.Bit;
                    matchFirstName.ParameterName = "@matchFirstName";
                    matchFirstName.Value         = request.matchFirstName;

                    var matchMiddleName = new SqlParameter();
                    matchMiddleName.SqlDbType     = SqlDbType.Bit;
                    matchMiddleName.ParameterName = "@matchMiddleName";
                    matchMiddleName.Value         = request.matchMiddleName;

                    var matchLastname = new SqlParameter();
                    matchLastname.SqlDbType     = SqlDbType.Bit;
                    matchLastname.ParameterName = "@matchLastname";
                    matchLastname.Value         = request.matchLastname;

                    var matchSex = new SqlParameter();
                    matchSex.SqlDbType     = SqlDbType.Bit;
                    matchSex.ParameterName = "@matchSex";
                    matchSex.Value         = request.matchSex;


                    var matchEnrollmentNumber = new SqlParameter();
                    matchEnrollmentNumber.SqlDbType     = SqlDbType.Bit;
                    matchEnrollmentNumber.ParameterName = "@matchEnrollmentNumber";
                    matchEnrollmentNumber.Value         = 0;

                    var matchDOB = new SqlParameter();
                    matchDOB.SqlDbType     = SqlDbType.Bit;
                    matchDOB.ParameterName = "@matchDOB";
                    matchDOB.Value         = request.matchDOB;


                    var matchEnrollmentDate = new SqlParameter();
                    matchEnrollmentDate.SqlDbType     = SqlDbType.Bit;
                    matchEnrollmentDate.ParameterName = "@matchEnrollmentDate";
                    matchEnrollmentDate.Value         = 0;


                    var matchARTStartDate = new SqlParameter();
                    matchARTStartDate.SqlDbType     = SqlDbType.Bit;
                    matchARTStartDate.ParameterName = "@matchARTStartDate";
                    matchARTStartDate.Value         = 0;

                    var matchHIVDiagnosisDate = new SqlParameter();
                    matchHIVDiagnosisDate.SqlDbType     = SqlDbType.Bit;
                    matchHIVDiagnosisDate.ParameterName = "@matchHIVDiagnosisDate";
                    matchHIVDiagnosisDate.Value         = 0;


                    _unitOfWork.Context.Database.SetCommandTimeout(3600);
                    var duplicatePersons = await _unitOfWork.Context.Query <DuplicatePersonsPoco>().FromSql(sql.ToString(), parameters: new []
                    {
                        matchFirstName,
                        matchMiddleName,
                        matchLastname,
                        matchSex,
                        matchEnrollmentNumber,
                        matchDOB,
                        matchEnrollmentDate,
                        matchARTStartDate,
                        matchHIVDiagnosisDate
                    }).AsNoTracking().ToListAsync();

                    return(Result <List <DuplicatePersonsPoco> > .Valid(duplicatePersons));
                }
                catch (Exception e)
                {
                    Log.Error(e, $"Could not fetch duplicate persons");
                    return(Result <List <DuplicatePersonsPoco> > .Invalid($"Could not fetch duplicate persons. Message: {e.Message}"));
                }
            }
        }