public IHttpActionResult PostStructure(string macAddress, DiagnosticInputModel diagnosticsModel)
        {
            var device = DeviceRepository.GetByMacAddress(MacAddress.From(macAddress));

            if (device == null)
            {
                LoggingComponent.LogError(MethodBase.GetCurrentMethod(), String.Format("Device with mac address {0} not found. Possible configuration error.", macAddress));
                return NotFound();
            }

            var deviceId = device.Id;
            var signboard = SignboardRepository.GetByDevice(deviceId);

            if (signboard == null)
            {
                LoggingComponent.LogError(MethodBase.GetCurrentMethod(), String.Format("Signboard with mac address {0} not found. Possible configuration error.", macAddress));
                return BadRequest();
            }

            var diagnostics = GetSignboardDiagnostics(signboard.Id, diagnosticsModel);
            DiagnosticsComponent.Write(diagnostics);

            var slideshow = SlideshowRepository.GetActiveBySignboard(signboard.Id);

            if (slideshow == null)
            {
                LoggingComponent.LogWarning(MethodBase.GetCurrentMethod(), "There is no slideshow attached to signboard with mac address " + macAddress);
            }

            var announcements = AnnouncementRepository.GetActiveBySignboard(signboard.Id);
            var announcementResponseModel = announcements.Select(x => AnnouncementResponseModel.From(x)).ToList();

            var requests = signboard.Requests.Where(x => x.State != RequestState.Cancelled && x.State != RequestState.Processed && x.State != RequestState.Sent);
            var signboardRequests = requests.Select(x => RequestResponseModel.From(x)).ToList();

            foreach (Request request in requests)
            {
                request.Sent();
            }

            var returnModel = GetStructureResponseModel(slideshow, announcementResponseModel, signboardRequests, signboard.IsShowingScreensaver, signboard.FontFactor);

            return Ok(returnModel);
        }
        private SignboardDiagnostics GetSignboardDiagnostics(Guid signboardId, DiagnosticInputModel diagnosticsModel)
        {
            var diagnostics = new SignboardDiagnostics(signboardId, diagnosticsModel.DiagnosticDate, SoftwareVersion.From(diagnosticsModel.SoftwareVersion));
            foreach (DiagnosticMetricInputModel metric in diagnosticsModel.Metrics)
            {
                diagnostics.AddMetricValue((DiagnosticMetricType)Enum.Parse(typeof(DiagnosticMetricType), metric.Name), metric.Value.ToString());
            }

            if (diagnosticsModel.SignboardHealth == null)
            {
                return diagnostics;
            }
            else
            {
                diagnostics.AddMetricValue(DiagnosticMetricType.SignboardState, diagnosticsModel.SignboardHealth.ScreenState);
                diagnostics.AddMetricValue(DiagnosticMetricType.IsShowingScreensaver, diagnosticsModel.SignboardHealth.IsShowingScreensaver.ToString());

                if (diagnosticsModel.SignboardHealth.SlideHealth == null || diagnosticsModel.SignboardHealth.SlideHealth.Count == 0)
                {
                    return diagnostics;
                }

                diagnostics.AddMetricValue(DiagnosticMetricType.SlideshowHealthMetric, diagnosticsModel.SignboardHealth.ToString());
            }

            return diagnostics;
        }