public static RavenMemoryDatabase BuildTestDatabase()
 {
     var database = BuildEmptyDatabase();
     var cryptography = new Cryptography();
     const string ravenUserId = "ravenuser/1";
     var testUser = new RavenUser
         {
             Id = ravenUserId,
             Username = "******",
             PasswordHash = cryptography.CreateHash("Abc123")
         };
     database.Store(testUser);
     const string feedId = "ravenfeed/1";
     var testFeed = new RavenFeed
         {
             Id = feedId,
             Url = "http://test.url.fake"
         };
     database.Store(testFeed);
     database.Store(new RavenUserFeed
         {
             Category = "testuser's test feeds",
             RavenFeedId = testFeed.Id,
             Id = "ravenuserfeed/1",
             Name = "testuser's test feed",
             RavenUserId = testUser.Id
         });
     const string feedItemId = "FeedItems/1";
     database.Store(new FeedItem
         {
             FeedId = feedId
         });
     database.Store(new UserFeedItem
         {
             FeedId = feedId,
             RavenUserId = ravenUserId,
             FeedItemId = feedItemId,
             IsUnread = true
         });
     return database;
 }
        //TODO switch to response object
        public Status Register(User user)
        {
            try
            {
                if (user == null)
                {
                    return new Status
                        {
                            ErrorLevel = ErrorLevel.Error,
                            ErrorMessage = "User cannot be null"
                        };
                }
                if (string.IsNullOrEmpty(user.Username))
                {
                    return new Status
                        {
                            ErrorLevel = ErrorLevel.Error,
                            ErrorMessage = "Username is required"
                        };
                }
                if (string.IsNullOrEmpty(user.Password))
                {
                    return new Status
                        {
                            ErrorLevel = ErrorLevel.Error,
                            ErrorMessage = "Password is required"
                        };
                }
                if (string.IsNullOrEmpty(user.Email))
                {
                    return new Status
                        {
                            ErrorLevel = ErrorLevel.Error,
                            ErrorMessage = "Email is required"
                        };
                }
                var storageUser = new RavenUser
                    {
                        Username = user.Username,
                        PasswordHash = _cryptography.CreateHash(user.Password),
                        Email = user.Email
                    };

                Status status = ValidateNewUser(user);
                if (status.ErrorLevel > ErrorLevel.None)
                {
                    return status;
                }

                _database.Store(storageUser);
                return new Status
                    {
                        ErrorLevel = ErrorLevel.None
                    };
            }
            catch (Exception ex)
            {
                return new Status
                    {
                        ErrorLevel = ErrorLevel.Critical,
                        ErrorMessage = string.Format("Fatal error registering user: {0}", ex),
                        ErrorException = ex
                    };
            }
        }