public async Task <int> DeleteLinkedAccounts(int type, int userId, int benefactorId)
        {
            try
            {
                int deleteResult = 0;
                if (type == ConnectionsType.ExistingConnection)
                {
                    /* Check for existing connection. */
                    var connection = (await GetDataByIdAsync(new { UserId = userId, BenefactorId = benefactorId, IsActive = true }));

                    if (connection != null)
                    {
                        /* Delete operation is performed. */
                        connection.isActive     = false;
                        connection.isDeleted    = true;
                        connection.modifiedBy   = benefactorId;
                        connection.modifiedDate = DateTime.UtcNow;
                        await UpdateAsync(connection, new { connection.id });

                        try
                        {
                            var userBenefactor = string.Empty;
                            using (var sqlConnection = await _databaseConnectionFactory.CreateConnectionAsync())
                            {
                                try
                                {
                                    userBenefactor = (await sqlConnection.QuerySingleOrDefaultAsync <User>(SQLQueryConstants.GetUserByIdQuery, new { Id = benefactorId, IsActive = true, IsDeleted = false })).Email;
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    sqlConnection.Close();
                                    sqlConnection.Dispose();
                                }
                            }
                            var invitation = (await _invitation.GetDataByIdAsync(new { CreatedBy = userId, Email = userBenefactor }));
                            if (invitation != null)
                            {
                                invitation.IsActive     = false;
                                invitation.IsDeleted    = true;
                                invitation.ModifiedBy   = benefactorId;
                                invitation.ModifiedDate = DateTime.UtcNow;
                                await _invitation.UpdateAsync(invitation, new { invitation.id });
                            }
                            var reloadRequest = (await _reloadRequest.AllAsync()).ToList().Where(x => x.userId == userId && x.benefactorUserId == benefactorId);
                            if (reloadRequest.Count() > 0)
                            {
                                foreach (var item in reloadRequest)
                                {
                                    item.isActive  = false;
                                    item.isDeleted = true;
                                    await _reloadRequest.UpdateAsync(item, new { item.id });
                                }
                            }
                            deleteResult = 1;
                        }
                        catch (Exception)
                        {
                            throw;
                        }
                    }
                }
                else
                {
                    /* Check for existing connection. */
                    var invitation = await _invitation.GetDataByIdAsync(new { CreatedBy = userId, Id = benefactorId, IsActive = true });

                    if (invitation != null)
                    {
                        /* Delete operation is performed. */
                        invitation.IsActive     = false;
                        invitation.IsDeleted    = true;
                        invitation.ModifiedBy   = userId;
                        invitation.ModifiedDate = DateTime.UtcNow;
                        deleteResult            = await _invitation.UpdateAsync(invitation, new { invitation.id });
                    }
                }
                return(deleteResult);
            }
            catch (Exception)
            {
                throw;
            }
        }