public AddClaimCostAttachmentWithFileApiRequest(
            AddClaimCostAttachmentApiModel addClaimCostAttachmentApiModel,
            FileAttachmentModel documentStorageModel)
        {
            Ensure.That(addClaimCostAttachmentApiModel, nameof(addClaimCostAttachmentApiModel)).IsNotNull();
            Ensure.That(documentStorageModel, nameof(documentStorageModel)).IsNotNull();

            this.AddClaimCostAttachmentApiModel = addClaimCostAttachmentApiModel;
            this.FileAttachment = documentStorageModel;
        }
        public AddClaimCostAttachmentApiRequest(AddClaimCostAttachmentApiModel addClaimCostAttachmentApiModel)
        {
            Ensure.That(addClaimCostAttachmentApiModel, nameof(addClaimCostAttachmentApiModel)).IsNotNull();

            this.AddClaimCostAttachmentApiModel = addClaimCostAttachmentApiModel;
        }
        public async Task <ActionResult <AddClaimCostAttachmentApiResponseModel> > AddClaimCostAttachment([FromForm] AddClaimCostAttachmentApiModel addClaimCostAttachmentApiModel)
        {
            ////I assume that we accept more than one file each request.
            if (this.Request.Form.Files.Count != 1)
            {
                ////TODO add error model for missing file attached to the request
                return(this.BadRequest());
            }

            ////Take this out from there and make it reusable.
            var file = this.Request.Form.Files[0];

            var fileAttachment = await file.ReadToFileAttachmentModel();

            var addClaimCostAttachmentApiRequest =
                new AddClaimCostAttachmentWithFileApiRequest(addClaimCostAttachmentApiModel, fileAttachment);

            var newClaimCostAttachment = await this.mediator.Send(addClaimCostAttachmentApiRequest);

            if (newClaimCostAttachment == null)
            {
                return(this.BadRequest());
            }

            return(this.CreatedAtRoute(nameof(GetSingleClaimCostAttachment), new { id = newClaimCostAttachment }));
        }