public AddTemplateDefinitionPageHandler(ITemplatingPersistenceConfiguration persistenceConfiguration,
                                                IResourceCommandHandler <SaveBitmapForTemplatePageCanvasDefinition, FileStorageRequestResult> saveCanvasHandler)
        {
            if (persistenceConfiguration == null)
            {
                throw new ArgumentNullException(nameof(persistenceConfiguration));
            }
            if (saveCanvasHandler == null)
            {
                throw new ArgumentNullException(nameof(saveCanvasHandler));
            }

            _persistenceConfiguration = persistenceConfiguration;
            _saveCanvasHandler        = saveCanvasHandler;
        }
        public AddBitmapForDocumentToProcessHandler(
            IQueryHandler <GetDocumentToProcess, DocumentToProcess> getDocumentToProcess,
            IResourceCommandHandler <SavePageBitmapForDocumentToProcess, FileStorageRequestResult> persistImageCommand)
        {
            if (getDocumentToProcess == null)
            {
                throw new ArgumentNullException(nameof(getDocumentToProcess));
            }
            if (persistImageCommand == null)
            {
                throw new ArgumentNullException(nameof(persistImageCommand));
            }

            _saveImageCommand     = persistImageCommand;
            _getDocumentToProcess = getDocumentToProcess;
        }
        public SynapseResource Handle(IKey key, SynapseResource resource) // Just for the observation, temporary implementation -- can be removed later
        {
            var hl7Type = key.TypeName.GetHl7ModelType();

            var modelFactory = this._provider.GetService(typeof(ResourceCommandHandlerFactory)) as ResourceCommandHandlerFactory;

            IResourceCommandHandler commandHandler = modelFactory.GetHandler(hl7Type);

            var fhirParam = FHIRParam.Create(key.TypeName, key.ResourceId, key.VersionId);

            var synapseResource = commandHandler.Handle(resource);

            if (synapseResource == null)
            {
                throw new InterneuronBusinessException(StatusCodes.Status500InternalServerError);
            }

            return(synapseResource);
        }