public Task <RegisterNodeResponse> HandleRegisterNodeRequest(RegisterNodeRequest request)
        {
            _logger?.Information($"Register Node Request Received " +
                                 $"(Node Name: {request.NodeName}, " +
                                 $"Device ID: {request.DeviceId}, " +
                                 $"Is Pull Node: {request.IsPullNode}).");

            var node = _nodeRepository.GetNode(request.NodeName, request.DeviceId, request.IsPullNode);

            var response = new RegisterNodeResponse
            {
                RequestId  = request.RequestId,
                NodeName   = node.NodeName,
                Successful = true
            };

            var pullNodes = _nodeRepository
                            .PullNodes
                            .Select(x => x.NodeName)
                            .ToList();

            response.PullNodeList.AddRange(pullNodes);

            _logger?.Information($"Sending Response to {response.NodeName} " +
                                 $"(Is Successful = {response.Successful}).");

            return(Task.FromResult(response));
        }
        public IHttpActionResult RegisterNode([FromBody] RegisterNodeRequest request)
        {
            if (request.Nodes.Count < 1)
            {
                return(BadRequest("Please supply valid list of nodes"));
            }

            RegisterNodes(request.Nodes);

            var response = new RegisterNodeResponse()
            {
                Message    = "New nodes have been added",
                TotalNodes = _nodes
            };

            return(Json(response));
        }