public InvoiceDocument ApiToDomain(Api.InvoiceDocument value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new InvoiceDocument
            {
                Id = value.Id.ToInt(),
                Created = value.Created.ToDateTime(),
                FileName = value.FileName,
                FileSize = value.FileSize.ToInt(),
                InvoiceId = value.InvoiceId.ToInt(),
                MimeType = value.MimeType,
                FileContent = MappingHelpers.ToByteArray(value.Base64File)
            });
        }
        public OfferDocument ApiToDomain(Api.OfferDocument value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new OfferDocument
            {
                Id = int.Parse(value.Id),
                Created = DateTime.Parse(value.Created, CultureInfo.InvariantCulture),
                FileName = value.FileName,
                FileSize = int.Parse(value.FileSize, CultureInfo.InvariantCulture),
                OfferId = int.Parse(value.OfferId, CultureInfo.InvariantCulture),
                MimeType = value.MimeType,
                FileContent = MappingHelpers.ToByteArray(value.Base64File)
            });
        }
        public InboxDocument ApiToDomain(Api.InboxDocument value)
        {
            if (value == null)
            {
                return(null);
            }

            return(new InboxDocument
            {
                Id = value.Id.ToInt(),
                FileSize = value.FileSize.ToInt(),
                FileName = value.FileName.Sanitize(),
                MimeType = value.MimeType.Sanitize(),
                UserId = value.UserId.ToInt(),
                Created = value.Created.ToDateTime(),
                PageCount = value.PageCount.ToInt(),
                Updated = value.Updated.ToDateTime(),
                FileContent = MappingHelpers.ToByteArray(value.Base64File),
                Metadata = value.Metadata?.Data?.ToDictionary(),
                DocumentType = MappingHelpers.ToInboxDocumentType(value.DocumentType)
            });
        }