public async Task <Twins> UpdateTwinTagsAsync([FromBody] TwinUpdateRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            if (request.TwinTags == null)
            {
                throw new ArgumentNullException("Tags");
            }

            var businessRequestTags = _mapper.Map <SIoT.Tags>(request.TwinTags);

            if (businessRequestTags != null)
            {
                SIoT.Twins data = await _iotService.UpdateTwinsAsync(request.DeviceId, JsonConvert.SerializeObject(new { tags = businessRequestTags }));

                if (data != null)
                {
                    return(_mapper.Map <Twins>(data));
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
        public async Task <string> RunTwinTagsUpdateJobAsync([FromBody] TwinUpdateJobRequest request)
        {
            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            if (request.TwinTags == null)
            {
                throw new ArgumentNullException("Tags");
            }

            string jobId = Guid.NewGuid().ToString();

            var twin = new SIoT.Twins();

            twin.Tags = _mapper.Map <SIoT.Tags>(request.TwinTags);

            if (twin.Tags != null)
            {
                //Send Twins but build new Twin Azure object at service level.
                var serviceRequest = new SIoT.TwinsSearchRequest();
                serviceRequest.WhereCondition = request.WhereConstraint;

                await _iotService.RunTwinUpdateJobAsync(jobId, request.WhereConstraint, twin);

                return(jobId);
            }
            else
            {
                return(string.Empty);
            }
        }