public async Task <IActionResult> Post([FromBody] BaseComponentViewModel stateChangeViewModel)
        {
            try
            {
                var id = Guid.Parse(stateChangeViewModel.ModuleId);

                var stateChange = new StateChange
                {
                    ModuleId = id,

                    State = stateChangeViewModel.State
                };

                await StateChangesRepository.CreateStateChange(stateChange);

                await ModuleRepository.UpdateModuleHeartbeat(new Module(id, stateChangeViewModel.State));

                var moduleResponse
                    = await StateChangesRepository
                      .PostStateChangeToBackendApi(stateChange);

                return(Ok(moduleResponse));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);

                return(BadRequest(new ErrorResponse(ex)));
            }
        }
        public async Task <IActionResult> Post([FromBody] BaseComponentViewModel heartbeatViewModel)
        {
            try
            {
                var id = Guid.Parse(heartbeatViewModel.ModuleId);

                var heartbeat = new Heartbeat
                {
                    ModuleId = id,

                    State = heartbeatViewModel.State
                };

                await HeartbeatRepository.CreateHeartbeat(heartbeat);

                await ModuleRepository.UpdateModuleHeartbeat
                    (new Module(id, heartbeatViewModel.State));

                return(Ok(heartbeat));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);

                return(BadRequest(new ErrorResponse(ex)));
            }
        }