/// <inheritdoc />
        public async Task <PagedList <Message> > GetAll(MessageParameters parameters = null)
        {
            var messages = this.GetQueryable();

            if (parameters != null)
            {
                switch (parameters.Container)
                {
                case MessageContainer.Unread:
                    messages = messages
                               .Where(m => m.IsRead == false);
                    break;

                case MessageContainer.Inbox:
                    break;

                case MessageContainer.Outbox:
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(parameters.Container), parameters.Container, null);
                }

                if (string.IsNullOrWhiteSpace(parameters.OrderBy) == false)
                {
                    if (parameters.OrderBy == nameof(Message.CreatedAt).ToLowerCamelCase())
                    {
                        messages = messages.OrderByDescending(m => m.CreatedAt);
                    }
                    else
                    {
                        throw new ArgumentOutOfRangeException(nameof(parameters.OrderBy), parameters.OrderBy, null);
                    }
                }
            }
            else
            {
                parameters = new MessageParameters();
            }

            return(await PagedList <Message> .CreateAsync(messages, parameters.PageNumber, parameters.PageSize));
        }
        /// <inheritdoc />
        public async Task <PagedList <Message> > GetByUser(Guid userID, MessageParameters parameters)
        {
            var messages = this.GetQueryableByUser(userID);

            switch (parameters.Container)
            {
            case MessageContainer.Unread:
                messages = messages
                           .Where(m => m.RecipientID == userID && m.RecipientDeleted == false && m.IsRead == false);
                break;

            case MessageContainer.Inbox:
                messages = messages
                           .Where(m => m.RecipientID == userID && m.RecipientDeleted == false);
                break;

            case MessageContainer.Outbox:
                messages = messages
                           .Where(m => m.SenderID == userID && m.SenderDeleted == false);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(parameters.Container), parameters.Container, null);
            }

            if (string.IsNullOrWhiteSpace(parameters.OrderBy) == false)
            {
                if (parameters.OrderBy == nameof(Message.CreatedAt).ToLowerCamelCase())
                {
                    messages = messages.OrderByDescending(m => m.CreatedAt);
                }
                else
                {
                    throw new ArgumentOutOfRangeException(nameof(parameters.OrderBy), parameters.OrderBy, null);
                }
            }

            return(await PagedList <Message> .CreateAsync(messages, parameters.PageNumber, parameters.PageSize));
        }