private WorkspaceMessageEntity toEntity(WorkspaceMessageTableEntity tableEntity)
        {
            WorkspaceMessageEntity entity = new WorkspaceMessageEntity();

            entity.WorkspaceID = tableEntity.PartitionKey;
            entity.Epoch       = tableEntity.RowKey;

            if (!string.IsNullOrWhiteSpace(tableEntity.Location))
            {
                entity.Location = tableEntity.Location;
            }

            if (!string.IsNullOrWhiteSpace(tableEntity.Message))
            {
                entity.Message = tableEntity.Message;
            }

            if (!string.IsNullOrWhiteSpace(tableEntity.Sender))
            {
                entity.UserID = tableEntity.Sender;
            }

            if (!string.IsNullOrWhiteSpace(tableEntity.Type))
            {
                entity.Type = tableEntity.Type;
            }

            return(entity);
        }
        private WorkspaceMessageTableEntity toTableEntity(WorkspaceMessageEntity entity)
        {
            WorkspaceMessageTableEntity tableEntity = new WorkspaceMessageTableEntity(entity.WorkspaceID, entity.Epoch);

            if (!string.IsNullOrWhiteSpace(entity.Location))
            {
                tableEntity.Location = entity.Location;
            }

            if (!string.IsNullOrWhiteSpace(entity.Message))
            {
                tableEntity.Message = entity.Message;
            }

            if (!string.IsNullOrWhiteSpace(entity.UserID))
            {
                tableEntity.Sender = entity.UserID;
            }

            if (!string.IsNullOrWhiteSpace(entity.Type))
            {
                tableEntity.Type = entity.Type;
            }

            return(tableEntity);
        }
 public async Task <WorkspaceMessageEntity> Get(string[] key, string[] value)
 {
     return(await Task <WorkspaceMessageEntity> .Run(() => {
         WorkspaceMessageTableEntity workspaceMessageTableEntity = this.cloudTable.Get(key, value).Result;
         return this.toEntity(workspaceMessageTableEntity);
     }));
 }
        public async Task <bool> Delete(WorkspaceMessageEntity entity)
        {
            WorkspaceMessageTableEntity workspaceMessageTableEntity = this.toTableEntity(entity);

            return(await this.cloudTable.Delete(workspaceMessageTableEntity));
        }